Skip to content

Commit

Permalink
Merge pull request #105 from DamirSvrtan/fix-redis-keys-triggering-ea…
Browse files Browse the repository at this point in the history
…ch-key-recommendation

Redis keys method should not trigger the each key recommendation
  • Loading branch information
DamirSvrtan authored Nov 13, 2023
2 parents e6e2f62 + 91c4519 commit 3bc3392
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.3.0','2.4.0','2.5.0','2.6.0','2.7.0','3.0.0','3.1.0','3.2.0']
ruby-version: ['2.5.0','2.6.0','2.7.0','3.0.0','3.1.0','3.2.0']

steps:
- uses: actions/checkout@v3
Expand Down
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 3bc3392

Please sign in to comment.