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.
Starting in 0.40.0 it does not find this error.
However 0.39.0 does under the same circumstances.
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
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?
Interestingly "filename" rule does not use .editorconfig, but I can reproduce this issue. Will check what is the cause.
Found the issue, will fix for the next release.
Most helpful comment
Found the issue, will fix for the next release.