Skip to content

Commit

Permalink
Merge pull request #20 from klausmeyer/fix/rubocop-rails-schema-loader
Browse files Browse the repository at this point in the history
fix: Support for rubocop-rails >= 2.24.0
  • Loading branch information
r7kamura committed May 3, 2024
2 parents 3ae8cc9 + dae96d9 commit 0eec069
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
21 changes: 12 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PATH
rubocop-migration (0.5.0)
activesupport
rubocop (>= 1.34)
rubocop-rails
rubocop-rails (>= 2.24)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -56,37 +56,40 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.60.2)
rubocop (1.63.4)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-ast (1.31.2)
parser (>= 3.3.0.4)
rubocop-capybara (2.20.0)
rubocop (~> 1.41)
rubocop-factory_bot (2.25.1)
rubocop (~> 1.41)
rubocop-performance (1.20.2)
rubocop (>= 1.48.1, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-rails (2.23.1)
rubocop-rails (2.24.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.30.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rake (0.6.0)
rubocop (~> 1.0)
rubocop-rspec (2.26.1)
rubocop-rspec (2.29.2)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
rubocop-rspec_rails (~> 2.28)
rubocop-rspec_rails (2.28.3)
rubocop (~> 1.40)
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
sevencop (0.35.1)
Expand All @@ -97,7 +100,7 @@ GEM
unicode-display_width (2.5.0)

PLATFORMS
x86_64-linux
ruby

DEPENDENCIES
rake
Expand Down
7 changes: 6 additions & 1 deletion lib/rubocop/cop/migration/add_index_duplicate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,14 @@ def leftmost_match?(
haystack.join(',').start_with?(needle.join(','))
end

# @return [Symbol]
def parser
respond_to?(:parser_engine) ? parser_engine : :parser_whitequark
end

# @return [RuboCop::Rails::SchemaLoader::Schema, nil]
def schema
@schema ||= ::RuboCop::Rails::SchemaLoader.load(target_ruby_version)
@schema ||= ::RuboCop::Rails::SchemaLoader.load(target_ruby_version, parser)
end

# @param node [RuboCop::AST::SendNode]
Expand Down
2 changes: 1 addition & 1 deletion rubocop-migration.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ Gem::Specification.new do |spec|

spec.add_dependency 'activesupport'
spec.add_dependency 'rubocop', '>= 1.34'
spec.add_dependency 'rubocop-rails'
spec.add_dependency 'rubocop-rails', '>= 2.24'
end

0 comments on commit 0eec069

Please sign in to comment.