Skip to content

Commit

Permalink
Merge pull request #380 from koic/require_rubocop_ast_1_30
Browse files Browse the repository at this point in the history
Require RuboCop AST 1.30.0+
  • Loading branch information
koic authored Nov 5, 2023
2 parents 4a4fb1d + afc80f5 commit e1d0b00
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 e1d0b00

Please sign in to comment.