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

Require RuboCop AST 1.30.0+ #380

Merged
merged 1 commit into from
Nov 5, 2023
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/change_require_rubocop_ast_1_30.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* [#380](https://github.com/rubocop/rubocop-performance/pull/380): Require RuboCop AST 1.30.0+. ([@koic][])
2 changes: 1 addition & 1 deletion lib/rubocop/cop/performance/inefficient_hash_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def use_long_method
end

def correct_argument(node)
node.arguments.first.source
node.first_argument.source
end

def correct_hash_expression(node)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def on_block(node)
return unless TARGET_METHODS.include?(node.method_name)
return unless one_block_argument?(node.arguments)

block_argument = node.arguments.first
block_argument = node.first_argument
block_body = node.body
return unless use_equality_comparison_block?(block_body)
return if same_block_argument_and_is_a_argument?(block_body, block_argument)
Expand Down
4 changes: 2 additions & 2 deletions lib/rubocop/cop/performance/reverse_first.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ def build_message(node)

def build_good_method(node)
if node.arguments?
"last(#{node.arguments.first.source}).reverse"
"last(#{node.first_argument.source}).reverse"
else
'last'
end
end

def build_bad_method(node)
if node.arguments?
"reverse.first(#{node.arguments.first.source})"
"reverse.first(#{node.first_argument.source})"
else
'reverse.first'
end
Expand Down
2 changes: 1 addition & 1 deletion rubocop-performance.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Gem::Specification.new do |s|
}

s.add_runtime_dependency('rubocop', '>= 1.7.0', '< 2.0')
s.add_runtime_dependency('rubocop-ast', '>= 0.4.0')
s.add_runtime_dependency('rubocop-ast', '>= 1.30.0', '< 2.0')
end