Ban .keys.first and .values.first
What does this MR do?
Add cop as suggested by issue #30349 (closed)
.keys.first
and .values.first
is memory and time consuming, we suggest to use .each_key.first
and .each_value.first
(or .first.first
and .first.second
)
This MR:
- Add a robucop cop to check
.keys.first
and.values.first
. It also auto-correct:.keys.first
=>each_key.first
,.values.first
=>.each_value.first
- Fixed the occurrences in existing files
Conformity
Edited by 🤖 GitLab Bot 🤖