diff --git a/changelog/change_rubocop_dependency_version.md b/changelog/change_rubocop_dependency_version.md new file mode 100644 index 0000000000..9c0cce3f94 --- /dev/null +++ b/changelog/change_rubocop_dependency_version.md @@ -0,0 +1 @@ +* [#729](https://github.com/rubocop/rubocop-rails/pulls/729): Change the minimum required `rubocop` dependency version to 1.31.0. ([@pirj][]) diff --git a/lib/rubocop/cop/rails/add_column_index.rb b/lib/rubocop/cop/rails/add_column_index.rb index 9bc6bb7cd4..384a92c70c 100644 --- a/lib/rubocop/cop/rails/add_column_index.rb +++ b/lib/rubocop/cop/rails/add_column_index.rb @@ -54,7 +54,7 @@ def on_send(node) def index_range(pair_node) range_with_surrounding_comma( - range_with_surrounding_space(range: pair_node.loc.expression, side: :left), + range_with_surrounding_space(pair_node.loc.expression, side: :left), :left ) end diff --git a/lib/rubocop/cop/rails/dot_separated_keys.rb b/lib/rubocop/cop/rails/dot_separated_keys.rb index e2b8b795e7..a60b458661 100644 --- a/lib/rubocop/cop/rails/dot_separated_keys.rb +++ b/lib/rubocop/cop/rails/dot_separated_keys.rb @@ -37,7 +37,7 @@ def on_send(node) add_offense(scope_node) do |corrector| # Eat the comma on the left. - range = range_with_surrounding_space(range: scope_node.source_range, side: :left) + range = range_with_surrounding_space(scope_node.source_range, side: :left) range = range_with_surrounding_comma(range, :left) corrector.remove(range) diff --git a/lib/rubocop/cop/rails/redundant_foreign_key.rb b/lib/rubocop/cop/rails/redundant_foreign_key.rb index e32d207aa1..21ccc18f4d 100644 --- a/lib/rubocop/cop/rails/redundant_foreign_key.rb +++ b/lib/rubocop/cop/rails/redundant_foreign_key.rb @@ -41,7 +41,7 @@ def on_send(node) association_with_foreign_key(node) do |type, name, options, foreign_key_pair, foreign_key| if redundant?(node, type, name, options, foreign_key) add_offense(foreign_key_pair.loc.expression) do |corrector| - range = range_with_surrounding_space(range: foreign_key_pair.source_range, side: :left) + range = range_with_surrounding_space(foreign_key_pair.source_range, side: :left) range = range_with_surrounding_comma(range, :left) corrector.remove(range) diff --git a/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb b/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb index d9a877abc9..ac48407a6e 100644 --- a/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb +++ b/lib/rubocop/cop/rails/redundant_presence_validation_on_belongs_to.rb @@ -217,7 +217,7 @@ def remove_keys_from_validation(corrector, node, keys) keys.each do |key| key_node = node.arguments.find { |arg| arg.value == key } key_range = range_with_surrounding_space( - range: range_with_surrounding_comma(key_node.source_range, :right), + range_with_surrounding_comma(key_node.source_range, :right), side: :right ) corrector.remove(key_range) @@ -226,7 +226,7 @@ def remove_keys_from_validation(corrector, node, keys) def remove_presence_option(corrector, presence) range = range_with_surrounding_comma( - range_with_surrounding_space(range: presence.source_range, side: :left), + range_with_surrounding_space(presence.source_range, side: :left), :left ) corrector.remove(range) diff --git a/rubocop-rails.gemspec b/rubocop-rails.gemspec index 225b28d505..96c9a49885 100644 --- a/rubocop-rails.gemspec +++ b/rubocop-rails.gemspec @@ -36,5 +36,5 @@ Gem::Specification.new do |s| # Rack::Utils::SYMBOL_TO_STATUS_CODE, which is used by HttpStatus cop, was # introduced in rack 1.1 s.add_runtime_dependency 'rack', '>= 1.1' - s.add_runtime_dependency 'rubocop', '>= 1.7.0', '< 2.0' + s.add_runtime_dependency 'rubocop', '>= 1.31.0', '< 2.0' end