-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Validate use of $0 only if it's "simple" #70
Comments
👍 |
Maybe only allow for single-line closures by default? |
Yeah... I often do this pattern: blablaFunc {
switch $0 {
// multiple cases
}
} But maybe that's very specific. I guess the important thing is that the |
I've implemented a rule for this, but it's pretty simple. It just validates that all foo.map {
bar.something { $0 }
} Wouldn't fail, but we feel like most of those cases will be caught by our line length as well. I can submit this upstream if the leniency is alright. |
@keith could you make a PR with your single-line rule? I can't guarantee we'd merge it right away, but it would be a good starting point, at least to stir a conversation. |
Yep, I'll do that soon. |
Submitted: #218 |
e.g. if it's the first thing that's switched on, or if the closure is really simple (not many tokens).
The text was updated successfully, but these errors were encountered: