-
Notifications
You must be signed in to change notification settings - Fork 507
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
ktlint --format should return error code if unable to autocorrect #2795
Comments
Normally the exit code will be set in case an unfixed error is found. I believe that in your case there is special situation in which multiple violations are found in the same file, which in the end do not change that file at all. In this case the exit code is not set properly. To be sure, I need to have a reproducable example. |
A single uncorrectable error will trigger the issue. The additional comment I made in #2794 with the .editorconfig should make it reproducible. |
…hanged In very rare cases it is possible that Lint violations are detected while formatting but that they have opposite effects and the file gets not altered at all. As the logging already might contain the message "Format was not able to resolve all violations which (theoretically) can be autocorrected in file ..." the format may not return with exit code 0. Closes #2795
I ran into a bug in ktlint earlier today, which has motivated this feature request. I ran
ktlint --format
locally, before submitting a pull request where the CI system runsktlint
.ktlint --format
did not fail locally (and I didn't look closely at the logs to see the warning), butktlint
on CI did fail.Expected Behavior
When running
ktlint --format
, any inability to autocorrect should be an error result code.Current Behavior
ktlint will print a warning, rather than returning an error result code.
Additional information
The text was updated successfully, but these errors were encountered: