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

Please upd for new fixed version of ktlint after fix https://github.com/pinterest/ktlint/issues/1256

Open YauheniPo opened this issue 4 years ago • 6 comments

YauheniPo avatar Oct 28 '21 15:10 YauheniPo

https://github.com/pinterest/ktlint/issues/1256

JLLeitschuh avatar Oct 29 '21 18:10 JLLeitschuh

You can also specify a custom ktlint version as an end-user

configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
    version.set("0.22.0")
}

JLLeitschuh avatar Oct 29 '21 18:10 JLLeitschuh

@JLLeitschuh ` BUILD FAILED in 2s 1 actionable task: 1 executed epopovich@MacBook-Pro-Yauheni ft % ./gradlew ktlintCheck

Task :loadKtlintReporters FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':loadKtlintReporters'.

KtLint versions less than 0.34.0 are not supported. Detected KtLint version: 0.22.0.

`

YauheniPo avatar Oct 31 '21 19:10 YauheniPo

What version did you specify?

JLLeitschuh avatar Nov 01 '21 22:11 JLLeitschuh

we use

buildscript {
    dependencies {
        classpath("com.google.protobuf:protobuf-gradle-plugin:${Versions.protobufPlugin}")
        classpath("org.jlleitschuh.gradle:ktlint-gradle:${Versions.ktlintPlugin}")
    }
    repositories {
        maven {
            url = uri("https://plugins.gradle.org/m2/")
        }
    }
}

apply(plugin = "org.jlleitschuh.gradle.ktlint")

plugins {
    kotlin("jvm") version Versions.kotlin
    id("java")
}

tasks.build {
    dependsOn("ktlintFormat")
}

subprojects {
    // Run ktlint check './gradlew ktlintCheck' for returning list of issues
    // Run ktlint format './gradlew ktlintFormat' for fixing issues
    // Add '--continue' option if you don't want to stop task execution in case of some of the subprojects tasks failed
    apply(plugin = "org.jlleitschuh.gradle.ktlint")

    configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
        debug.set(true)
        verbose.set(true)
        android.set(false)
        outputToConsole.set(true)
        outputColorName.set("RED")
        ignoreFailures.set(false)
        enableExperimentalRules.set(true)
        reporters {
            reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.HTML)
            reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE)
        }
    }

    task("printVersion") {
        doLast {
            println(version)
        }
    }
}

const val ktlintPlugin = "10.2.0"

YauheniPo avatar Nov 01 '21 22:11 YauheniPo

Try adding:

allprojects {
    configure<org.jlleitschuh.gradle.ktlint.KtlintExtension> {
        version.set("0.42.1")
    }
}

JLLeitschuh avatar Nov 02 '21 03:11 JLLeitschuh