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

Format was not able to resolve all violations which (theoretically) can be autocorrected #2726

Closed
paul-dingemans opened this issue Jul 2, 2024 · 0 comments · Fixed by #2727
Milestone

Comments

@paul-dingemans
Copy link
Collaborator

In case a file only contains lint violations which are suppressed using the baseline, then ktlint 1.3.0 keeps reporting that format was not able to resolve all violations which (theoretically) can be autocorrected.

Assume that the file Foo.kt contains code below:

val foo = foo(
    "foo"
)

and .editorconfig:

root = true

[*.{kt,kts}]
ktlint_code_style = ktlint_official
ktlint_standard = enabled
ktlint_experimental = enabled

Run command rm baseline.xml && ktlint **/Foo.kt --baseline=baseline.xml to delete the existing baseline.xml and recreate a new baseline.xml file. The created baseline.xml file looks like:

<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
    <file name="src/main/kotlin/Foo.kt">
        <error line="1" column="11" source="standard:multiline-expression-wrapping" />
        <error line="2" column="10" source="standard:trailing-comma-on-call-site" />
    </file>
</baseline>

Running ktlint-dev **/Foo.kt --baseline=baseline.xml -F --relative results in:

11:00:10.368 [pool-1-thread-1] WARN com.pinterest.ktlint.rule.engine.internal.CodeFormatter -- Format was not able to resolve all violations which (theoretically) can be autocorrected in file /###/src/main/kotlin/Foo.kt in 3 consecutive runs of format.
@paul-dingemans paul-dingemans added this to the 1.3.1 milestone Jul 2, 2024
paul-dingemans added a commit that referenced this issue Jul 2, 2024
The warning "Format was not able to resolve all violations" should not be logged in case the code only contains lint violations which may not be autocorrected according to the AutoCorrectHandler.

Closes #2726
paul-dingemans added a commit that referenced this issue Jul 2, 2024
The warning "Format was not able to resolve all violations" should not be logged in case the code only contains lint violations which may not be autocorrected according to the AutoCorrectHandler.

Closes #2726
paul-dingemans added a commit that referenced this issue Jul 2, 2024
…(theoretically) can be autocorrected` (#2727)

The warning "Format was not able to resolve all violations" should not be logged in case the code only contains lint violations which may not be autocorrected according to the AutoCorrectHandler.

Closes #2726
paul-dingemans added a commit that referenced this issue Jul 2, 2024
The warning "Format was not able to resolve all violations" should not be logged in case the code only contains lint violations which may not be autocorrected according to the AutoCorrectHandler.

Closes #2726
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant