codeclimate/codeclimate

View on GitHub
lib/cc/config/engine_set.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Use each_key instead of keys.each.
Open

        DefaultAdapter::ENGINES.keys.each do |name|
Severity: Minor
Found in lib/cc/config/engine_set.rb by rubocop

Checks for uses of each_key and each_value Hash methods.

NOTE: If you have an array of two-element arrays, you can put parentheses around the block arguments to indicate that you're not working with a hash, and suppress RuboCop offenses.

Safety:

This cop is unsafe because it cannot be guaranteed that the receiver is a Hash. The AllowedReceivers configuration can mitigate, but not fully resolve, this safety issue.

Example:

# bad
hash.keys.each { |k| p k }
hash.values.each { |v| p v }

# good
hash.each_key { |k| p k }
hash.each_value { |v| p v }

Example: AllowedReceivers: ['execute']

# good
execute(sql).keys.each { |v| p v }
execute(sql).values.each { |v| p v }

There are no issues that match your filters.

Category
Status