Kotlinter 3.12.0 complains about `disabled_rules` and lints stuff in generated-sources
henrik242 opened this issue · comments
Tried updating to 3.12.0, but I'm not able to get rid of these:
Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
[repeated maaany times]
Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
/Users/foo/src/bar-app/buildSrc/build/generated-sources/kotlin-dsl-accessors/kotlin/gradle/kotlin/dsl/accessors/_33a194716742ed17c4f8baa5f74fe207/TestRuntimeOnlyDependenciesMetadataConfigurationAccessors.kt:27:18: Lint error > [trailing-comma-on-call-site] Missing trailing comma before ")"
Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
[repeated maaany times]
Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
/Users/foo/src/bar-app/buildSrc/build/generated-sources/kotlin-dsl-accessors/kotlin/gradle/kotlin/dsl/accessors/_33a194716742ed17c4f8baa5f74fe207/Accessorsbjzfxoa3vns0zfsjg3ibeiv28.kt:27:18: Lint error > [trailing-comma-on-call-site] Missing trailing comma before ")"
Property 'disabled_rules' is deprecated: Rename property 'disabled_rules' to 'ktlint_disabled_rules' in all '.editorconfig' files.
[many more repeats and many more classes in generated-sources follows]
I have renamed disabled_rules
to ktlint_disabled_rules
.
Just to confirm: you're running the ./gradlew lintKotlin
task, right?
Can you try with ./gradlew --stop
before running ./gradlew lintKotlin
, to confirm nothing got cached? (I want to make sure I didn't miss any scenario in #265)
Just to confirm: you're running the ./gradlew lintKotlin task, right?
Yup!
Can you try with ./gradlew --stop before running ./gradlew lintKotlin, to confirm nothing got cached?
Thanks, that fixed the Property 'disabled_rules' is deprecated
messages. It's still trying to lint stuff in generated-sources
though.
It's still trying to lint stuff in generated-sources though.
Can you share which plugin generates files under generated-sources
? And which task tries to run them over generated files.
btw. you can manually configure Kotlinter to exclude generated files (in a slightly confusing way 😬) - I can link a similar issue which lists couple of examples how to exclude generated files: #256
Can you share which plugin generates files under generated-sources?
It seems like the kotlin-dsl itself. Not 100% sure though.
btw. you can manually configure Kotlinter to exclude generated files
Could do that, but weird that this isn't a problem in 3.10.x
It seems like the kotlin-dsl itself.
I'm fairly sure kotlin-dsl doesn't generate any sources 👀
Could do that, but weird that this isn't a problem in 3.10.x
Huh, I don't recall any changes around recognizing sourcesets 🤔 I'd rather guess ktlint
was invoked against generated sources, but it simply didn't find any issues. Could that be the case?
I'd love to see a sample project that reproduces the scenario you describe 👀
I'm going to close the issue for now, I hope nobody will mind that - There is nothing we can change on the plugin side as for this moment, I shared the workaround that skips linting generated source (#256), and we'll need a repro project before we can investigate the issue any further 👀
Hi, sorry for the late reply. Somehow I'm still having problems with the generated sources, even with the exclude from #265
$ ./gradlew --stop
Stopping Daemon(s)
1 Daemon stopped
Finished at man 2 jan 2023 14:00:31 CET
$ ./gradlew lintKotlin --no-configuration-cache --rerun-tasks
Starting a Gradle Daemon, 6 stopped Daemons could not be reused, use --status for details
Type-safe project accessors is an incubating feature.
> Configure project :buildSrc
WARNING: Unsupported Kotlin plugin version.
The `embedded-kotlin` and `kotlin-dsl` plugins rely on features of Kotlin `1.7.10` that might work differently than in the requested version `1.8.0`.
> Task :buildSrc:lintKotlinMain
/Users/foo/src/finn/foo-app2/buildSrc/build/generated-sources/kotlin-dsl-external-plugin-spec-builders/kotlin/gradle/kotlin/dsl/plugins/_50c5e4b1076861bcabac21b03c0c99c5/PluginSpecBuilders.kt:26:18: Lint error > [trailing-comma-on-call-site] Missing trailing comma before ")"
/Users/foo/src/finn/foo-app2/buildSrc/build/generated-sources/kotlin-dsl-accessors/kotlin/gradle/kotlin/dsl/accessors/_fd918eead956bdac562d69dc00a276db/Accessors9osmdt78klrrxidc9srcw3tsq.kt:27:18: Lint error > [trailing-comma-on-call-site] Missing trailing comma before ")"
...
I'm on kotlin 1.8 and kotlinter 3.13.0. (The results are the same on kotlin 1.7.x)
@henrik242 Can you share how did you apply kotlinter to your buildSrc
project? And post the config that suppose to exclude generated files? Ideally, a standalone repro project, would help a lot 👀
Regarding the generated-sources problem. Adding this helped:
tasks.withType<org.jmailen.gradle.kotlinter.tasks.ConfigurableKtLintTask>().configureEach {
exclude { it.file.path.contains("build") }
}
(idea from JLLeitschuh/ktlint-gradle#266 (comment))
I first tried exclude("**/build/**")
, but that didn't work.