Skip to content

Commit

Permalink
Redis keys method should not trigger the each key recommendation
Browse files Browse the repository at this point in the history
  • Loading branch information
DamirSvrtan committed Aug 20, 2023
1 parent 0a23bff commit 304e16d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/fasterer/scanners/method_call_scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ def check_each_offense
when :reverse
add_offense(:reverse_each_vs_reverse_each)
when :keys
add_offense(:keys_each_vs_each_key)
if method_call.receiver.arguments.count.zero?
add_offense(:keys_each_vs_each_key)
end
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/support/analyzer/15_keys_each_vs_each_key.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@
end

HASH.each_key(&:to_sym)

@redis.keys('queue:*').each do |queue_name|
puts queue_name
end

0 comments on commit 304e16d

Please sign in to comment.