Skip to content

Commit

Permalink
Pass range as a positional arg
Browse files Browse the repository at this point in the history
  • Loading branch information
pirj committed Jun 27, 2022
1 parent b671caa commit b9c28f7
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions 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][])
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rails/add_column_index.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rails/dot_separated_keys.rb
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/rubocop/cop/rails/redundant_foreign_key.rb
Expand Up @@ -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)
Expand Down
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion rubocop-rails.gemspec
Expand Up @@ -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

0 comments on commit b9c28f7

Please sign in to comment.