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

Add Performance/MinMaxAfterMap rule #387

Merged
merged 2 commits into from
Jul 10, 2023
Merged

Conversation

Sija
Copy link
Member

@Sija Sija commented Jul 10, 2023

This rule is used to identify usage of min/max/minmax calls that follow map.

For example, this is considered invalid:

%w[Alice Bob].map(&.size).min
%w[Alice Bob].map(&.size).max
%w[Alice Bob].map(&.size).minmax

And it should be written as this:

%w[Alice Bob].min_of(&.size)
%w[Alice Bob].max_of(&.size)
%w[Alice Bob].minmax_of(&.size)

@Sija Sija added the rule label Jul 10, 2023
@Sija Sija added this to the 1.5.0 milestone Jul 10, 2023
@Sija Sija requested a review from veelenga July 10, 2023 13:37
@Sija Sija self-assigned this Jul 10, 2023
@Sija Sija force-pushed the feature/minmax-after-map-rule branch from 7a7c055 to ddff8d2 Compare July 10, 2023 13:46
Co-authored-by: Vitalii Elenhaupt <3624712+veelenga@users.noreply.github.com>
@Sija Sija requested a review from veelenga July 10, 2023 14:09
Copy link
Member

@veelenga veelenga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@Sija Sija merged commit 33c8273 into master Jul 10, 2023
2 of 4 checks passed
@Sija Sija deleted the feature/minmax-after-map-rule branch July 10, 2023 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants