Skip to content

Commit

Permalink
Require RuboCop AST 1.30.0+
Browse files Browse the repository at this point in the history
  • Loading branch information
koic committed Nov 5, 2023
1 parent 4a4fb1d commit afc80f5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
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

0 comments on commit afc80f5

Please sign in to comment.