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

[Rule Request] Prefer reduce(into:_:) over reduce(_:_:) #2658

Closed
marcelofabri opened this issue Feb 22, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@marcelofabri
Copy link
Collaborator

commented Feb 22, 2019

New Issue Checklist

New rule request

  1. Why should this rule be added? Share links to existing discussion about what
    the community thinks about this.

The docs say:

This method is preferred over reduce(::) for efficiency when the result is a copy-on-write type, for example an Array or a Dictionary.

  1. Provide several examples of what would and wouldn't trigger violations.

See #2657 for some examples.

  1. Should the rule be configurable, if so what parameters should be configurable?

Just severity

  1. Should the rule be opt-in or enabled by default? Why?
    See README.md for guidelines on when to mark a rule as opt-in.

Enabled by default if we can avoid false positives

@jpsim

This comment has been minimized.

Copy link
Collaborator

commented Feb 25, 2019

Enabled by default if we can avoid false positives

I’d love to see a rule like this but I don’t know if I’d enable it by default. If the code isn’t performance critical, there are times when the legibility of the other reduce function makes it worth using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.