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

Pass range as a positional arg #729

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/change_rubocop_dependency_version.md
@@ -0,0 +1 @@
* [#729](https://github.com/rubocop/rubocop-rails/pull/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