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 experimental rules are never applied in gradle plugin #1636

Closed
6 tasks done
dhoepelman opened this issue Mar 21, 2023 · 2 comments
Closed
6 tasks done

Ktlint experimental rules are never applied in gradle plugin #1636

dhoepelman opened this issue Mar 21, 2023 · 2 comments
Labels

Comments

@dhoepelman
Copy link

dhoepelman commented Mar 21, 2023

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
@dhoepelman dhoepelman changed the title Ktlint experimental rules are never applied Ktlint experimental rules are never applied in gradle plugin Mar 23, 2023
@nedtwigg nedtwigg added the bug label Mar 23, 2023
@dhoepelman
Copy link
Author

dhoepelman commented Mar 23, 2023

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.

@dhoepelman
Copy link
Author

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

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

No branches or pull requests

2 participants