Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support rubocop 0.53.0 #31

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .rubocop_schema.53.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Configuration for Rubocop >= 0.53.0

Layout/AlignHash:
EnforcedColonStyle: 'key'
EnforcedHashRocketStyle: 'key'

Layout/ExtraSpacing:
# When true, allows most uses of extra spacing if the intent is to align
# things with the previous or next line, not counting empty lines or comment
# lines.
AllowForAlignment: false

Layout/SpaceBeforeFirstArg:
Enabled: true

Style/NumericLiterals:
Enabled: false

Metrics/BlockNesting:
Max: 2

Style/WordArray:
Enabled: false

Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: 'comma'

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: 'comma'

Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: 'comma'

Style/HashSyntax:
EnforcedStyle: 'ruby19'

Style/StringLiterals:
EnforcedStyle: double_quotes
12 changes: 11 additions & 1 deletion lib/fix_db_schema_conflicts/autocorrect_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,23 @@ def self.load
end

def load
at_least_rubocop_49? ? '.rubocop_schema.49.yml' : '.rubocop_schema.yml'
if at_least_rubocop_53?
'.rubocop_schema.53.yml'
elsif at_least_rubocop_49?
'.rubocop_schema.49.yml'
else
'.rubocop_schema.yml'
end
end

private

def at_least_rubocop_49?
Gem::Version.new('0.49.0') <= Gem.loaded_specs['rubocop'].version
end

def at_least_rubocop_53?
Gem::Version.new('0.53.0') <= Gem.loaded_specs['rubocop'].version
end
end
end
1 change: 0 additions & 1 deletion spec/integration/integration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

def reference_db_schema
<<-RUBY
# encoding: UTF-8

# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
Expand Down
1 change: 0 additions & 1 deletion spec/test-app/db/schema.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# encoding: UTF-8

# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
Expand Down
8 changes: 7 additions & 1 deletion spec/unit/autocorrect_configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,18 @@
expect(autocorrect_config.load).to eq('.rubocop_schema.yml')
end

it 'for versions 0.49.0 and above' do
it 'for versions 0.49.0 up to but not including 0.53.0' do
installed_rubocop(version: '0.49.0')

expect(autocorrect_config.load).to eq('.rubocop_schema.49.yml')
end

it 'for versions 0.53.0 and above' do
installed_rubocop(version: '0.53.0')

expect(autocorrect_config.load).to eq('.rubocop_schema.53.yml')
end

def installed_rubocop(version:)
allow(Gem).to receive_message_chain(:loaded_specs, :[], :version)
.and_return(Gem::Version.new(version))
Expand Down