diff --git a/README.md b/README.md index c8290953..39b6099a 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,7 @@ kotlinter { reporters = arrayOf("checkstyle", "plain") experimentalRules = false disabledRules = emptyArray() + ktlintVersion = "x.y.z" } ``` @@ -171,6 +172,7 @@ kotlinter { reporters = ['checkstyle', 'plain'] experimentalRules = false disabledRules = [] + ktlintVersion = 'x.y.z' } ``` @@ -188,6 +190,9 @@ disabledRules = ["no-wildcard-imports"] ``` You must prefix rule ids not part of the standard rule set with `:`. For example `experimental:annotation`. +There is a basic support for overriding `ktlintVersion`, but the plugin doesn't guarantee backwards compatibility with all `ktlint` versions. +Errors like `java.lang.NoSuchMethodError:` or `com/pinterest/ktlint/core/KtLint$Params` can be thrown if provided `ktlint` version isn't compatible with the latest ktlint apis. + ### Editorconfig Kotlinter will configure itself using an `.editorconfig` file if one is present. @@ -225,6 +230,34 @@ tasks.named('lintKotlinMain') { Note that exclude paths are relative to the package root. +#### Advanced +By default, `Kotlinter` Gradle workers will use 256MB of heap size. To adjust this setting use: +
+Kotlin + +```kotlin +import org.jmailen.gradle.kotlinter.tasks.ConfigurableKtLintTask + +tasks.withType { + workerMaxHeapSize.set("512m") +} +``` + +
+ +
+Groovy + +```groovy +import org.jmailen.gradle.kotlinter.tasks.ConfigurableKtLintTask + +tasks.withType(ConfigurableKtLintTask::class).configureEach { + workerMaxHeapSize.set("512m") +} +``` + +
+ ### Custom Tasks If you aren't using autoconfiguration from a supported plugin or otherwise need to handle additional source code, you can create custom tasks: @@ -284,61 +317,9 @@ tasks.register('ktFormat', FormatTask) { -### Custom ktlint version - -If you need to use a different version of `ktlint` you can override the dependency. - -
-Kotlin - -```kotlin -buildscript { - configurations.classpath { - resolutionStrategy { - force( - "com.pinterest.ktlint:ktlint-core:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-checkstyle:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-json:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-html:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-plain:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-sarif:0.39.0", - "com.pinterest.ktlint:ktlint-ruleset-experimental:0.39.0", - "com.pinterest.ktlint:ktlint-ruleset-standard:0.39.0" - ) - } - } -} -``` - -
- -
-Groovy - -```groovy -buildscript { - configurations.classpath { - resolutionStrategy { - force( - "com.pinterest.ktlint:ktlint-core:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-checkstyle:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-json:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-html:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-plain:0.39.0", - "com.pinterest.ktlint:ktlint-reporter-sarif:0.39.0", - "com.pinterest.ktlint:ktlint-ruleset-experimental:0.39.0", - "com.pinterest.ktlint:ktlint-ruleset-standard:0.39.0" - ) - } - } -} -``` - -
- ### Custom Rules -You can add custom ktlint RuleSets using the `ktlintRuleSet` dependency: +You can add custom `ktlint` RuleSets using the `ktlintRuleSet` dependency:
Kotlin