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

ktlint-cli baseline file should not contain absolute filenames #2146

Closed
paul-dingemans opened this issue Jul 23, 2023 · 0 comments · Fixed by #2147
Closed

ktlint-cli baseline file should not contain absolute filenames #2146

paul-dingemans opened this issue Jul 23, 2023 · 0 comments · Fixed by #2147

Comments

@paul-dingemans
Copy link
Collaborator

Ktlint CLI expects the baseline file to contain errors stored per relative file. Instead the errors are store for absolute filenames. As a result Ktlint CLI does not suppress the errors for a baseline that it has created.

Reproduce:

  1. Create a file Foo.kt containing code below:
fun Foo() = "foo"
  1. Remove baseline.xml
  2. Create new baseline.xml with ktlint --baseline=baseline.xml. Baseline contains an error for a file with an absolute path:
<?xml version="1.0" encoding="utf-8"?>
<baseline version="1.0">
    <file name="/some/absolute/path/project/src/main/kotlin/Foo.kt">
        <error line="1" column="5" source="standard:function-naming" />
    </file>
</baseline>
  1. Rerun ktlint --baseline=baseline.xml and note that the error is reported while it should have been suppressed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant