Ruby

Ruby

Made by DeepSource

Use flat_map to flatten maps RB-PR1011

Performance
Major
Autofix

flat_map is more efficient than flatten. Refer here.

Bad practice

[1, 2, 3, 4].map { |e| [e, e] }.flatten(1)

Recommended

[1, 2, 3, 4].flat_map { |e| [e, e] }

By default, flatten without any arguments do not raise any issues. Set EnabledForFlattenWithoutParams to true in your .rubocop.yml to enable it.