ktlint-gradle icon indicating copy to clipboard operation
ktlint-gradle copied to clipboard

Ktlint creates tasks eagerly

Open matejdro opened this issue 2 years ago • 2 comments

It seems like ktlint creates its tasks eagerly some time after initializing them lazily.

Running ./gradlew :samples:kotlin-ks:help -Dorg.gradle.internal.tasks.stats example from https://github.com/JLLeitschuh/ktlint-gradle/pull/186 will show that ktlint tasks were created:

Task types that were registered with the new API but were created anyways
class org.gradle.api.DefaultTask 11
class org.jlleitschuh.gradle.ktlint.tasks.GenerateReportsTask 6
class org.jlleitschuh.gradle.ktlint.tasks.KtLintCheckTask 3
class org.jlleitschuh.gradle.ktlint.tasks.KtLintFormatTask 3

This is with version https://github.com/JLLeitschuh/ktlint-gradle/commit/2d8f427fba07ec60a109a291512fa2e2c73a40d3.

matejdro avatar Sep 06 '21 11:09 matejdro

We have test that should check such behaviour :thinking:

@JLLeitschuh could you check if this test is enough?

Also I've noticed that Task types that were registered with the new API but were created anyways message in the report is printed twice - first time for all task types in the project and second time only for some of them. And second time message does not contain any plugin tasks.

Tapchicoma avatar Sep 07 '21 20:09 Tapchicoma

@JLLeitschuh could you check if this test is enough?

Not at this time, sorry, ktlint-gradle is a bit on the back burner for me at this time. I'm happy to continue to review PRs, but this isn't something I can commit to at this time.

JLLeitschuh avatar Sep 08 '21 15:09 JLLeitschuh