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

FilenameRule does not find lint errors if missing editorconfig (new in 0.40.0) #997

Closed
jeremymailen opened this issue Dec 7, 2020 · 3 comments · Fixed by #1015
Closed
Assignees
Labels
Milestone

Comments

@jeremymailen
Copy link
Contributor

Expected Behavior

The filename rule should produce a lint error when the kotlin source file name does not match the symbol declared whether or not an editorconfig is present or if it is missing path section which includes the offending file.

Observed Behavior

Starting in 0.40.0 it does not find this error.
However 0.39.0 does under the same circumstances.

Steps to Reproduce

Create file src/main/kotlin/Wrong.kt

class Right

(no editorconfig)
ktlint src/main/kotlin/Wrong.kt and it does not find any errors

with editorconfig

[*.{kt,kts}]
indent_size = 4

a lint error will be found

src/main/kotlin/Wrong.kt:1:1: class Right should be declared in a file named Right.kt (cannot be auto-corrected)

If you again change the editorconfig file to the below, the lint error will disappear again

[src/test/**/*.{kt,kts}]
indent_size = 4

Your Environment

  • MacOS
  • ktlint 0.40.0
  • Java 11
@orchestr7
Copy link
Contributor

orchestr7 commented Dec 7, 2020

We also faced this, @romtsn @Tapchicoma, but it looks to be an expected behavior.
May be we will add default values for editor config to workaround it?

@Tapchicoma
Copy link
Collaborator

Interestingly "filename" rule does not use .editorconfig, but I can reproduce this issue. Will check what is the cause.

@Tapchicoma
Copy link
Collaborator

Found the issue, will fix for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants