Ktlint experimental rules are never applied in gradle plugin
dhoepelman opened this issue · 2 comments
ktlint
experimental rules are supported since #1168 .
While configuration is available, neither it nor the right .editorconfig
entry seem to have any effect.
A repository showing a minimal reproducing example of the problem can be found here.
Given this config:
spotless {
kotlin {
target("**/*.kt", "**/*.kts")
ktlint("0.48.2")
.setUseExperimental(true)
.setEditorConfigPath("$rootDir/.editorconfig")
}
}
(I also tried some variations of the above, but it doesn't matter)
and a file Test.kt
:
val triggersExperimentalRule = false
Running ./gradlew spotlessCheck --stacktrace
will be successful:
$ ./gradlew spotlessCheck --stacktrace
BUILD SUCCESSFUL in 403ms
3 actionable tasks: 2 executed, 1 up-to-date
while ktlint
fails:
$ ktlint
10:29:33.192 [main] INFO com.pinterest.ktlint.internal.KtlintCommandLine - Enable default patterns [**/*.kt, **/*.kts]
[...]/bug-spotless-ktlint-experimental-rules/src/main/kotlin/Test.kt:1:5: Property name should use the screaming snake case notation when the value can not be changed (cannot be auto-corrected) (experimental:property-naming)
Summary error count (descending) by rule:
experimental:property-naming: 2
- summary of problem
- gradle or maven version: 8.0.2 or 7.6
- spotless version: 6.17.0
- operating system and version: OS X 13.2.1
- copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
- copy-paste the full content of any console errors emitted by
gradlew spotless[Apply/Check] --stacktrace
This might be 0.48+ specific, they have changed the API in 0.48. Additional context. If I have time I may investigate.
Another thing from the 0.48.2 release notes it seems that ktlint want to discourage config like setUseExperimental
and let .editorconfig
be the source of truth.
This specific bug is likely irrelevant since spotless 0.6.20, as this mentioned the behavior changing in the changelo
https://github.com/diffplug/spotless/blob/main/plugin-gradle/CHANGES.md#6200---2023-07-17