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
Autocorrect reports success even though nothing happens #466
Comments
@tkohout could you please share code that reproduces this issue? We have tests in place that ensure that the corrections are successfully applied, maybe they're incomplete? See https://github.com/realm/SwiftLint/blob/0.8.0/Source/SwiftLintFramework/Rules/CommaRule.swift#L32-L37
Obviously this is a bug. It's not SwiftLint's design to print that something was corrected when in fact it wasn't. |
I've reproduced this by running
There were no changes for any of the reported "Statement Position" corrections. I believe this is because a no-op correction was applied (string was overwritten to the same value). I think the right solution here is to fix the cases in which this happens. The "Legacy Constructor" corrections were correctly being reported, but incorrectly being corrected since the "violations" were in string literals, which the rule should be resilient against. I'm investigating all this now. |
Awesome, thanks for quick response |
Still happens in 0.9.0, saying it corrected comma spacing for a file, but not modifying it. |
@aldrich as I mentioned in my previous comment, we have yet to reproduce issues with "Comma Spacing" rule. Can you share some sample code that demonstrates the issue? |
@jpsim I found reproducing example: let a = [1,1] // produces violation, but not triggers correcting.
let b = 1
f(1, b) // does not produce violation, but triggers correcting. |
Cool, thanks @norio-nomura! Let's reopen this one. |
This issues is happening to me in the version 0.25.0 with the legacy_contructo rule
I'm running Thanks, |
@fbarraganef please create a new issue following the issue template. Thanks! |
When I call
swiftlint autocorrect
I get a report like this:
But no file is modified,
I noticed it happens with
Statement Position and Comma Spacing, but there might be more.
Other rules get corrected corectly. It would be nice to at least to not display the success message if the rule fails to correct the error. It's a bit confusing.
Thanks
The text was updated successfully, but these errors were encountered: