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

Share motivation/rational for each rule #1822

Open
lwouis opened this issue Aug 20, 2024 · 2 comments
Open

Share motivation/rational for each rule #1822

lwouis opened this issue Aug 20, 2024 · 2 comments

Comments

@lwouis
Copy link

lwouis commented Aug 20, 2024

Hi,

Thank you for this great project!

I ran it on our project in linter mode. The first error I got was preferForLoop. I thought that it's interesting that SwiftFormat considers that it's a bad practice to use forEach, and recommands using a for loop instead. However, I was left a bit curious as to why forEach is a bad practice.

I looked around in discussions on this project, but couldn't find a place where the motivation/rational beyind each rule is.

What would you think about adding this extra piece of information? I think it could help developers to know why a pattern is to be avoided, in addition to pointing it out.

Thank you 🙇‍♂️

@nicklockwood
Copy link
Owner

Yes, this is a good idea

@NikKovIos
Copy link

for in is more controllable, but equal in performance measurement
https://stackoverflow.com/a/45334483/5790492

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