mrmans0n / compose-rules

Lint rules for ktlint/detekt aimed to contribute to a healthier usage of Compose. Actively maintained and evolved fork of the Twitter Compose rules.
https://mrmans0n.github.io/compose-rules
Other
550 stars 21 forks source link

version 0.4.8 causes ktlintCheck to fail #306

Closed petros-chariskos closed 1 month ago

petros-chariskos commented 1 month ago

org.jlleitschuh.gradle.ktlint plugin version: 12.1.1 io.nlopez.compose.rules:ktlint version: 0.4.8

Running ./gradlew ktlintCheck it results with:

> Task :androidApp:runKtlintCheckOverTestSourceSet FAILED
> Task :components:runKtlintCheckOverKotlinScripts FAILED
> Task :androidApp:runKtlintCheckOverKotlinScripts FAILED
> Task :androidApp:runKtlintCheckOverMainSourceSet FAILED
> Task :components:runKtlintCheckOverMainSourceSet FAILED

Note: Current working version is ktlint: 12.1.1 and compose.rules:ktlint : 0.4.4

mrmans0n commented 1 month ago

0.4.6 updated ktlint version to 1.3.1. See here : https://github.com/mrmans0n/compose-rules/releases/tag/v0.4.6

Can you check which version of ktlint your project is using? Being in sync with that version should fix it that I think.

petros-chariskos commented 1 month ago

It seems that the ktlint-gradle plugin is defaulting the ktlint version to 1.0.1. https://github.com/JLLeitschuh/ktlint-gradle/blob/main/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/KtlintExtension.kt

When I explicitly change the version to 1.3.1 within ktlint {} then it works as intended. Thanks for the hint! You can close this issue.

mrmans0n commented 1 month ago

Glad to know, thanks for reporting!