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

Set KtLint version to 0.43.2

Open joaocsousa opened this issue 4 years ago • 6 comments

joaocsousa avatar Nov 22 '21 15:11 joaocsousa

Should set this to 0.43.1 now.

@JLLeitschuh can we please get this upgrade into a version of the Gradle plugin? Would be great to update for new Ktlint features.

zsmb13 avatar Dec 01 '21 10:12 zsmb13

@zsmb13 0.43.1 just fixes KtLint CLI issue and does not affect Gradle plugin itself. Regarding version update - you could always to update it via ktlint extesion: version.set("0.43.1")

Tapchicoma avatar Dec 01 '21 10:12 Tapchicoma

Should set this to 0.43.1 now.

@JLLeitschuh can we please get this upgrade into a version of the Gradle plugin? Would be great to update for new Ktlint features.

"Note: Please do not use the 0.43.1 release" Note from here:0.43.2

dineshbhagat avatar Dec 03 '21 08:12 dineshbhagat

I had another look and tests seem to be failing with this error message:

* What went wrong:
Execution failed for task ':runKtlintCheckOverMainSourceSet'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > Could not initialize class com.pinterest.ktlint.ruleset.experimental.trailingcomma.TrailingCommaRule

Version 0.43.0 introduced a new TrailingCommaRule and I'm afraid fixing this bug is beyond my capabilities. I am willing to give it a shot if someone wants to point me in the right direction, otherwise unfortunately I'll have to leave this one for more knowledgeable contributors.

joaocsousa avatar Dec 05 '21 08:12 joaocsousa

I think it's not related to TrailingCommaRule but related to Kotlin API 1.4 usage

I got that error on running tests :

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':runKtlintCheckOverMainSourceSet'.
> Caused by: org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
> Caused by: java.lang.NoSuchMethodError: 'void kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(java.lang.Class, java.lang.String, java.lang.String, int)'
at com.pinterest.ktlint.ruleset.experimental.trailingcomma.TrailingCommaRule.<clinit>(TrailingCommaRule.kt:37)

void kotlin.jvm.internal.MutablePropertyReference1Impl.<init>(java.lang.Class, java.lang.String, java.lang.String, int) has the annotation @SinceKotlin(version = "1.4")

Indeed, ktlint upgraded their API version to 1.4 since the 0.43.0

I suppose from this comment that we have to upgrade gradle plugins as well in order to support 0.38.0 and versions 0.43+ : https://github.com/JLLeitschuh/ktlint-gradle/blob/477a00779f30cb3262758e495ea966d2272efbb2/plugin/src/test/kotlin/org/jlleitschuh/gradle/ktlint/KtLintSupportedVersionsTest.kt#L105

rbleuse avatar Jan 06 '22 02:01 rbleuse

I believe that this is now outdated by #597, correct?

JLLeitschuh avatar Aug 23 '22 15:08 JLLeitschuh