Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The max after the map is removed #489

Open
kojix2 opened this issue Oct 21, 2024 · 4 comments
Open

The max after the map is removed #489

kojix2 opened this issue Oct 21, 2024 · 4 comments

Comments

@kojix2
Copy link

kojix2 commented Oct 21, 2024

Code:

list.map { |i| i.size }.max

Ameba auto correct

ameba --fix

The map is not replaced with max_of, but simply max is removed.

list.map(&.size)
@kojix2
Copy link
Author

kojix2 commented Oct 21, 2024

The original code when I discovered this behavior was:

max = glossary_list.map { |g| g.name.size }.max.not_nil!

@Sija
Copy link
Member

Sija commented Oct 24, 2024

Interestingly it occurs only when both Style/VerboseBlock and Performance/MinMaxAfterMap rules are enabled and trying to auto-correct the code.

@Sija
Copy link
Member

Sija commented Oct 24, 2024

@FnControlOption Could you take a look at it, please?

@FnControlOption
Copy link
Contributor

Hi @Sija, hope you are doing well. Unfortunately, I won’t have much time to look at this until around December 14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants