-
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
Enable implicit_return
and fix all violations
#5658
Enable implicit_return
and fix all violations
#5658
Conversation
Here's an example of your CHANGELOG entry: * Enable `implicit_return` and fix all violations.
[mildm8nnered](https://github.com/mildm8nnered)
[#issue_number](https://github.com/realm/SwiftLint/issues/issue_number) note: There are two invisible spaces after the entry's text. Generated by 🚫 Danger |
Can you give an example for such an adjustment? Is it something that the rewriter could do better? |
So I didn't actually use the rewriter, because I didn't spot that the rule subclassed Trying the rewriter, it actually has a few problems:
becomes
which fails to compile with
Manually I had
Rolling through the autocorrects, it looks like when we have nested implicit returns, that causes problems. I haven't looked into what's going on, but I suspect that the offsets for the nested implicit return are off once the outer one has been corrected. The whitespace issues were actually much more minor. In a case like SyntacticSugarRule
corrected to
This will then violate one of the parameter alignment rules. I'll write up the Rewriter issues separately - it would be nice to fix that, as this is a rule that people probably have a lot of violations of, and doing them by hand is probably a pain for most people. Something I also missed running the auto-correction was the ability to specify a single rule to enable on the command line. Please autocorrect just this one rule - unless I'm missing something and we can already do that. |
fccfec2
to
233043a
Compare
The only changes here are
implicit_return
return
threw things out.