{"id":13428739,"url":"https://github.com/JLLeitschuh/ktlint-gradle","last_synced_at":"2025-03-16T01:33:29.877Z","repository":{"id":37743144,"uuid":"84131083","full_name":"JLLeitschuh/ktlint-gradle","owner":"JLLeitschuh","description":"A ktlint gradle plugin","archived":false,"fork":false,"pushed_at":"2024-10-28T22:48:45.000Z","size":1745,"stargazers_count":1467,"open_issues_count":92,"forks_count":160,"subscribers_count":16,"default_branch":"main","last_synced_at":"2024-10-29T15:19:43.452Z","etag":null,"topics":["gradle","gradle-plugin","gradle-script-kotlin","hacktoberfest","kotlin","ktlint","linting"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JLLeitschuh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-06T23:19:40.000Z","updated_at":"2024-10-28T22:47:15.000Z","dependencies_parsed_at":"2023-11-07T00:34:42.594Z","dependency_job_id":"48ed0706-f38c-48f5-bf4d-2fb3b7391cee","html_url":"https://github.com/JLLeitschuh/ktlint-gradle","commit_stats":{"total_commits":766,"total_committers":60,"mean_commits":"12.766666666666667","dds":0.3955613577023499,"last_synced_commit":"7fc6fe24b68c673f152a38b3dbffca768f98f847"},"previous_names":[],"tags_count":68,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLLeitschuh%2Fktlint-gradle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLLeitschuh%2Fktlint-gradle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLLeitschuh%2Fktlint-gradle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JLLeitschuh%2Fktlint-gradle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JLLeitschuh","download_url":"https://codeload.github.com/JLLeitschuh/ktlint-gradle/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814905,"owners_count":20352037,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gradle","gradle-plugin","gradle-script-kotlin","hacktoberfest","kotlin","ktlint","linting"],"created_at":"2024-07-31T01:01:03.896Z","updated_at":"2025-03-16T01:33:29.869Z","avatar_url":"https://github.com/JLLeitschuh.png","language":"Kotlin","funding_links":[],"categories":["Libraries","gradle","Kotlin"],"sub_categories":[],"readme":"# Ktlint Gradle\n\n**Provides a convenient wrapper plugin over the [ktlint](https://github.com/pinterest/ktlint) project.**\n\n\u003c!-- Note: if changing the line below, the `sed` command in the perform-release.yaml needs to be updated too --\u003e\nLatest plugin version: [12.2.0](/CHANGELOG.md#---20250227)\n\n[![Join the chat at https://kotlinlang.slack.com](https://img.shields.io/badge/slack-@kotlinlang/ktlint-yellow.svg?logo=slack)](https://kotlinlang.slack.com/messages/CKS3XG0LS)\n[![Build and Check](https://github.com/JLLeitschuh/ktlint-gradle/actions/workflows/build-and-check.yml/badge.svg)](https://github.com/JLLeitschuh/ktlint-gradle/actions/workflows/build-and-check.yml)\n[![ktlint](https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg)](https://ktlint.github.io/)\n[![Gradle Plugin Portal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/org/jlleitschuh/gradle/ktlint/org.jlleitschuh.gradle.ktlint.gradle.plugin/maven-metadata.xml.svg?colorB=007ec6\u0026label=gradlePluginPortal)](https://plugins.gradle.org/plugin/org.jlleitschuh.gradle.ktlint)\n[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/JLLeitschuh/ktlint-gradle/badge)](https://securityscorecards.dev/viewer/?uri=github.com/JLLeitschuh/ktlint-gradle)\n\nThis plugin creates convenient tasks in your Gradle project\nthat run [ktlint](https://github.com/pinterest/ktlint) checks or do code\nauto format.\n\nThe plugin can be applied to any project, but only activates if that project has the kotlin plugin applied.\nThe assumption being that you would not want to lint code you weren't compiling.\n\n## Table of content\n- [Supported Kotlin plugins](#supported-kotlin-plugins)\n- [How to use](#how-to-use)\n  - [Minimal support versions](#minimal-supported-versions)\n  - [Ktlint plugin](#ktlint-plugin)\n    - [Simple setup](#simple-setup)\n    - [Using legacy apply method](#using-legacy-apply-method)\n    - [How to apply to all subprojects](#applying-to-subprojects)\n    - [Baseline support](#baseline-support)\n    - [Testing KtLint snapshots](#testing-ktlint-snapshots)\n  - [Intellij IDEA plugin](#intellij-idea-only-plugin)\n    - [Simple setup](#idea-plugin-simple-setup)\n    - [Using legacy apply method](#idea-plugin-setup-using-legacy-apply-method)\n  - [Plugin configuration](#configuration)\n    - [Setting reports output directory](#setting-reports-output-directory)\n    - [Customer reporters](#custom-reporters)\n    - [Changing workers memory usage](#changing-workers-memory-usage)\n  - [Samples](#samples)\n- [Task details](#tasks-added)\n  - [Main tasks](#main-tasks)\n  - [Additional tasks](#additional-helper-tasks)\n- [FAQ](#faq)\n- [Developers](#developers)\n  - [Importing the project](#importing)\n  - [Building the project](#building)\n- [Links](#links)\n\n## Supported Kotlin plugins\n\nThis plugin supports the following kotlin plugins:\n- \"kotlin\"\n- \"kotlin-android\"\n- \"kotlin-multiplatform\"\n- project kotlin script files\n- \"org.jetbrains.kotlin.js\"\n\nIf you know any new Kotlin plugin that is not in this list - please,\nopen a [new issue](https://github.com/JLLeitschuh/ktlint-gradle/issues/new).\n\n## How to use\n\n### Minimal supported versions\n\nThis plugin was written using the new API available for the Gradle script Kotlin builds.\nThis API is available in new versions of Gradle.\n\nMinimal supported [Gradle](https://www.gradle.org) version: `7.4`\n\nMinimal supported [Kotlin](https://kotlinlang.org) version: `1.4`\n\nMinimal supported [ktlint](https://github.com/pinterest/ktlint) version: `0.47.1`\n\nMinimal supported [Android Gradle plugin](https://developer.android.com/build) version: `4.1.0`\n\n### Ktlint plugin\n\n#### Simple setup\n\nBuild script snippet for new plugin mechanism introduced in Gradle 2.1:\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\nplugins {\n  id \"org.jlleitschuh.gradle.ktlint\" version \"\u003ccurrent_version\u003e\"\n}\n\nrepositories {\n  // Required to download KtLint\n  mavenCentral()\n}\n```\n\u003c/details\u003e\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n\n```kotlin\nplugins {\n  id(\"org.jlleitschuh.gradle.ktlint\") version \"\u003ccurrent_version\u003e\"\n}\n\nrepositories {\n  // Required to download KtLint\n  mavenCentral()\n}\n```\n\u003c/details\u003e\n\n#### Using Version Catalog\n\nTo configure the plugin using a version catalog, first, add the following entries to your libs.versions.toml file:\n\n```toml\n[versions]\nktlint = \"\u003ccurrent_version\u003e\"\n\n[plugins]\nktlint = { id = \"org.jlleitschuh.gradle.ktlint\", version.ref = \"ktlint\" }\n```\n\nNext, apply it to your project:\n\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\nplugins {\n  alias(libs.plugins.ktlint)\n}\n\nrepositories {\n  // Required to download KtLint\n  mavenCentral()\n}\n```\n\u003c/details\u003e\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n\n```kotlin\nplugins {\n  alias(libs.plugins.ktlint)\n}\n\nrepositories {\n  // Required to download KtLint\n  mavenCentral()\n}\n```\n\u003c/details\u003e\n\n#### Using legacy apply method\n\nBuild script snippet for use in all Gradle versions:\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\nbuildscript {\n  repositories {\n    maven {\n      url \"https://plugins.gradle.org/m2/\"\n    }\n  }\n  dependencies {\n    classpath \"org.jlleitschuh.gradle:ktlint-gradle:\u003ccurrent_version\u003e\"\n  }\n}\n\nrepositories {\n  // Required to download KtLint\n  mavenCentral()\n}\n\napply plugin: \"org.jlleitschuh.gradle.ktlint\"\n```\n\u003c/details\u003e\n\u003cdetails\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n\n```kotlin\nbuildscript {\n  repositories {\n    maven(\"https://plugins.gradle.org/m2/\")\n  }\n  dependencies {\n    classpath(\"org.jlleitschuh.gradle:ktlint-gradle:\u003ccurrent_version\u003e\")\n  }\n}\n\nrepositories {\n  // Required to download KtLint\n  mavenCentral()\n}\n\napply(plugin = \"org.jlleitschuh.gradle.ktlint\")\n```\n\u003c/details\u003e\n\n#### Applying to subprojects\n\nOptionally apply plugin to all project modules:\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\nsubprojects {\n    apply plugin: \"org.jlleitschuh.gradle.ktlint\" // Version should be inherited from parent\n\n    repositories {\n        // Required to download KtLint\n        mavenCentral()\n    }\n\n    // Optionally configure plugin\n    ktlint {\n        debug = true\n    }\n}\n```\n\u003c/details\u003e\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n\n```kotlin\nsubprojects {\n    apply(plugin = \"org.jlleitschuh.gradle.ktlint\") // Version should be inherited from parent\n\n    repositories {\n        // Required to download KtLint\n        mavenCentral()\n    }\n\n    // Optionally configure plugin\n    configure\u003corg.jlleitschuh.gradle.ktlint.KtlintExtension\u003e {\n        debug.set(true)\n    }\n}\n```\n\u003c/details\u003e\n\n#### Baseline support\n\nPlugin supports KtLint baseline with following limitations:\n- Format tasks ignore baseline. See [#1072](https://github.com/pinterest/ktlint/issues/1072) KtLint issue for more details.\n- One baseline file is generated per one Gradle project (module).\n\nRun task `ktlintGenerateBaseline` to generate a new baseline.\n\n#### Testing KtLint snapshots\n\nTo test KtLint snapshots add following configuration into project build script (latest KtLint snapshot version name\nyou could find [here](https://github.com/pinterest/ktlint/blob/master/gradle.properties#L1)):\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\nrepositories {\n    maven {\n      url 'https://oss.sonatype.org/content/repositories/snapshots'\n    }\n}\n\nktlint {\n  version = \"0.41.0-SNAPSHOT\"\n}\n```\n\u003c/details\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n\n```kotlin\nrepositories {\n    maven(\"https://oss.sonatype.org/content/repositories/snapshots\")\n}\n\nktlint {\n    version.set(\"0.41.0-SNAPSHOT\")\n}\n```\n\u003c/details\u003e\n\n### IntelliJ Idea Only Plugin\n\n**Note:** This plugin is automatically applied by the main `ktlint` plugin.\n\nThis plugin just adds [special tasks](#additional-helper-tasks) that can generate IntelliJ IDEA codestyle\nrules using ktlint.\n\n#### Idea plugin simple setup\n\nBuild script snippet for new plugin mechanism introduced in Gradle 2.1:\n```kotlin\nplugins {\n  id(\"org.jlleitschuh.gradle.ktlint-idea\") version \"\u003ccurrent_version\u003e\"\n}\n```\n\n#### Idea plugin setup using legacy apply method\n\nFor all Gradle versions:\n\nUse the same `buildscript` logic as [above](#simple-setup), but with this instead of the above suggested `apply` line. If you also want the GIT pre-commit gradle tasks, keep both `apply` variations.\n\n```groovy\napply plugin: \"org.jlleitschuh.gradle.ktlint-idea\"\n```\n\n### Configuration\nThe following configuration block is _optional_.\n\nIf you don't configure this the defaults defined\nin the [KtlintExtension](plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/KtlintExtension.kt)\nobject will be used.\n\nThe version of ktlint used by default _may change_ between patch versions of this plugin.\nIf you don't want to inherit these changes then make sure you lock your version here.\nConsult the [ktlint release notes](https://github.com/pinterest/ktlint/releases) for more information about the differences between ktlint versions.\n\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\nimport org.jlleitschuh.gradle.ktlint.reporter.ReporterType\n\nktlint {\n    version = \"0.22.0\"\n    debug = true\n    verbose = true\n    android = false\n    outputToConsole = true\n    outputColorName = \"RED\"\n    ignoreFailures = true\n    enableExperimentalRules = true\n    additionalEditorconfigFile = file(\"/some/additional/.editorconfig\")  // not supported with ktlint 0.47+\n    additionalEditorconfig = [ // not supported until ktlint 0.49\n        \"max_line_length\": \"20\"\n    ]\n    disabledRules = [\"final-newline\"] // not supported with ktlint 0.48+\n    baseline = file(\"my-project-ktlint-baseline.xml\")\n    reporters {\n        reporter \"plain\"\n        reporter \"checkstyle\"\n        reporter \"sarif\"\n\n        customReporters {\n            \"csv\" {\n                fileExtension = \"csv\"\n                dependency = project(\":project-reporters:csv-reporter\")\n            }\n            \"yaml\" {\n                fileExtension = \"yml\"\n                dependency = \"com.example:ktlint-yaml-reporter:1.0.0\"\n            }\n        }\n    }\n    kotlinScriptAdditionalPaths {\n        include fileTree(\"scripts/\")\n    }\n    filter {\n        exclude(\"**/generated/**\")\n        include(\"**/kotlin/**\")\n    }\n}\n\ndependencies {\n    ktlintRuleset \"com.github.username:rulseset:main-SNAPSHOT\"\n    ktlintRuleset files(\"/path/to/custom/rulseset.jar\")\n    ktlintRuleset project(\":chore:project-ruleset\")\n}\n```\n\u003c/details\u003e\n\nor in kotlin script:\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n\n```kotlin\nimport org.jlleitschuh.gradle.ktlint.reporter.ReporterType\n\nconfigure\u003corg.jlleitschuh.gradle.ktlint.KtlintExtension\u003e {\n    version.set(\"0.22.0\")\n    debug.set(true)\n    verbose.set(true)\n    android.set(false)\n    outputToConsole.set(true)\n    outputColorName.set(\"RED\")\n    ignoreFailures.set(true)\n    enableExperimentalRules.set(true)\n    additionalEditorconfigFile.set(file(\"/some/additional/.editorconfig\")) // not supported with ktlint 0.47+\n    additionalEditorconfig.set( // not supported until ktlint 0.49\n        mapOf(\n            \"max_line_length\" to \"20\"\n        )\n    )\n    disabledRules.set(setOf(\"final-newline\")) // not supported with ktlint 0.48+\n    baseline.set(file(\"my-project-ktlint-baseline.xml\"))\n    reporters {\n        reporter(ReporterType.PLAIN)\n        reporter(ReporterType.CHECKSTYLE)\n\n        customReporters {\n            register(\"csv\") {\n                fileExtension = \"csv\"\n                dependency = project(\":project-reporters:csv-reporter\")\n            }\n            register(\"yaml\") {\n                fileExtension = \"yml\"\n                dependency = \"com.example:ktlint-yaml-reporter:1.0.0\"\n            }\n        }\n    }\n    kotlinScriptAdditionalPaths {\n        include(fileTree(\"scripts/\"))\n    }\n    filter {\n        exclude(\"**/generated/**\")\n        include(\"**/kotlin/**\")\n    }\n}\n\ndependencies {\n    ktlintRuleset(\"com.github.username:rulseset:main-SNAPSHOT\")\n    ktlintRuleset(files(\"/path/to/custom/rulseset.jar\"))\n    ktlintRuleset(project(\":chore:project-ruleset\"))\n}\n```\n\u003c/details\u003e\n\n#### Setting reports output directory\n\nIt is possible also to define different from default output directory for generated reports\n (by default it is \"build/reports/ktlint\"):\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\ntasks.withType(org.jlleitschuh.gradle.ktlint.tasks.GenerateReportsTask) {\n    reportsOutputDirectory = project.layout.buildDirectory.dir(\"other/location/$name\")\n}\n```\n\u003c/details\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin script\u003c/summary\u003e\n\n```kotlin\ntasks.withType\u003corg.jlleitschuh.gradle.ktlint.tasks.GenerateReportsTask\u003e {\n    reportsOutputDirectory.set(\n        project.layout.buildDirectory.dir(\"other/location/$name\")\n    )\n}\n```\n\u003c/details\u003e\n\n#### Custom reporters\n\n**Note**: If Ktlint custom reporter creates report output file internally, for example:\n```kotlin\nclass CsvReporter(\n    private val out: PrintStream\n) : Reporter {\n    override fun onLintError(file: String, err: LintError, corrected: Boolean) {\n        val line = \"$file;${err.line};${err.col};${err.ruleId};${err.detail};$corrected\"\n        out.println(line)\n        File(\"some_other_file.txt\").write(line) // \u003c-- Here!!!\n    }\n}\n```\n\"some_other_file.txt\" won't be captured as task output. This may lead to the problem,\nthat task will always be not \"UP_TO_DATE\" and caching will not work.\n\n#### Changing workers memory usage\n\nBy default, KtLint Gradle workers will use at most 256mb of heap size. For some projects it may be not enough,\nbut it is possible to change:\n\n\u003cdetails\u003e\n\u003csummary\u003eGroovy\u003c/summary\u003e\n\n```groovy\ntasks.withType(org.jlleitschuh.gradle.ktlint.tasks.BaseKtLintCheckTask).configureEach {\n    it.workerMaxHeapSize.set(\"512m\")\n}\n```\n\u003c/details\u003e\n\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin script\u003c/summary\u003e\n\n```kotlin\ntasks.withType\u003corg.jlleitschuh.gradle.ktlint.tasks.BaseKtLintCheckTask\u003e {\n    workerMaxHeapSize.set(\"512m\")\n}\n```\n\u003c/details\u003e\n\n### Samples\n\nThis repository provides the following examples of how to set up this plugin:\n- [android-app](/samples/android-app) - applies plugin to android application project\n- [kotlin-gradle](/samples/kotlin-gradle) - applies plugin to plain Kotlin project that uses groovy in `build.gradle` files\n- [kotlin-js](/samples/kotlin-js) - applies plugin to kotlin js project\n- [kotlin-ks](/samples/kotlin-ks) - applies plugin to plain Kotlin project that uses Kotlin DSL in `build.gradle.kts` files\n- [kotlin-multiplatform](/samples/kotlin-mpp) - applies plugin to Kotlin common multiplatform module\n- [kotlin-multiplatform-android](/samples/kotlin-mpp-android) - applies plugin to Kotlin android multiplatform module\n- [kotlin-rulesets-using](/samples/kotlin-rulesets-using) - adds custom [example](/samples/kotlin-rulesets-creating) ruleset\n- [kotlin-reporter-using](/samples/kotlin-reporter-using) - adds custom [example](/samples/kotlin-reporter-creating) reporter\n\n## Tasks Added\n\n### Main tasks\n\nThis plugin adds following tasks to every project:\n- `loadKtlintReporters` - preloads KtLint `Reporter`s\n- `runKtlintCheckOverKotlinScripts` - runs actual lint check over project Kotlin script files\n- `ktlintKotlinScriptCheck` - generates reports and prints issues into Gradle console based on lint check found errors.\n  This task execution depends on `loadKtlintReporters` and `runKtlintCheckOverKotlinScripts` tasks execution outputs\n- `runKtlintFormatOverKotlinScripts` - tries to format according to the code style project Kotlin script files\n- `ktlintKotlinScriptFormat` - generate reports and prints issues into Gradle console based on found non-formattable errors.\n  This task execution depends on `loadKtlintReporters` and `runKtlintFormatOverKotlinScripts` tasks execution outputs\n- `ktlintCheck` - checks all `SourceSet`s and project Kotlin script files\n- `ktlintFormat` - tries to format according to the code style all `SourceSet`s Kotlin files and project Kotlin script files\n\nThen for each `SourceSet` plugin adds following tasks:\n- `runKtlintCheckOver[source set name]SourceSet` - runs actual lint check on every Kotlin file in given `SourceSet`\n- `ktlint[source set name]SourceSetCheck` - generates reports and prints issues into Gradle console based on lint check found errors.\n  This task execution depends on `loadKtlintReporters` and `runKtlintCheckOver[source set name]SourceSet` tasks execution outputs\n- `runKtlintFormatOver[source set name]SourceSet` - tries to format according to the code style every Kotlin file in given `SourceSet`\n- `ktlint[source set name]SourceSetFormat` - reformats files, generates reports and prints issues into Gradle console based on found non-formattable errors.\n  This task execution depends on `loadKtlintReporters` and `runKtlintFormatOver[source set name]SourceSet` tasks execution outputs\n\n### Additional helper tasks\n\nFollowing additional  tasks are added:\n- `ktlintApplyToIdea` - The task generates IntelliJ IDEA (or Android Studio) Kotlin\n                        style files in the project `.idea/` folder. **Note** that this task will overwrite the existing style file.\n- `ktlintApplyToIdeaGlobally` - The task generates IntelliJ IDEA (or Android Studio) Kotlin\n                                style files in the user home IDEA\n                                (or Android Studio) settings folder. **Note** that this task will overwrite the existing style file.\n- `addKtlintCheckGitPreCommitHook` - adds [Git](https://www.git-scm.com/) `pre-commit` hook,\nthat runs ktlint check over staged files.\n- `addKtlintFormatGitPreCommitHook` - adds [Git](https://www.git-scm.com/) `pre-commit` hook,\nthat runs ktlint format over staged files and adds fixed files back to commit.\n\nAll these additional tasks are always added **only** to the root project.\n\n## FAQ\n\n- Is it possible to not stop task execution if some of the subprojects tasks failed?\n\nYes. Just use gradle `--continue` option:\n```shell\n$ ./gradlew --continue ktlintCheck\n```\n\n- Can I mix old plugin and new plugin API setup in my project\n(see [simple-setup](#simple-setup) and [using legacy apply method](#using-legacy-apply-method))?\n\nNo. These approaches are not equivalent to how they work. The problem that\nthe plugin may not find some of the kotlin plugins if both approaches are used\nin the project configuration. Especially it is related to the Android plugin.\n\n- Does plugin check change files incrementally?\n\nYes, check tasks support it. On the first run, the task will check all files in the source set, on\nsubsequent runs it will check only added/modified files.\n\nFormat tasks do not check files incrementally.\n\n- I could not filter dynamically attached sources that are located outside of the project dir.\n\nGradle based filtering are only working for files located inside project (subproject) folder, see https://github.com/gradle/gradle/issues/3417\nTo filter files outside project dir, use:\n```kotlin\nexclude { element -\u003e element.file.path.contains(\"generated/\") }\n```\n\n- Running KtLint fails with strange exception (for example, check [#383](https://github.com/JLLeitschuh/ktlint-gradle/issues/383))\n\nEnsure you are not pinning Kotlin version for \"ktlint*\" configurations added by plugin.\n\nKtLint relies on Kotlin compiler to parse source files. Each version of KtLint are build using specific Kotlin version.\n\nTo exclude \"ktlint*\" Gradle configurations from Kotlin version pinning - use following approach:\n```kotlin\nconfigurations.all {\n    if (!name.startsWith(\"ktlint\")) {\n        resolutionStrategy {\n            eachDependency {\n                // Force Kotlin to our version\n                if (requested.group == \"org.jetbrains.kotlin\") {\n                    useVersion(\"1.3.72\")\n                }\n            }\n        }\n    }\n}\n```\n\n## Developers\n\n### Importing\n\nImport the [settings.gradle.kts](settings.gradle.kts) file into your IDE.\n\nTo enable the Android sample either define the `ANDROID_HOME` environmental variable or\nadd a `local.properties` file to the project root folder with the following content:\n```properties\nsdk.dir=\u003candroid-sdk-location\u003e\n```\n\n### Building\n\nBuilding the plugin: `./plugin/gradlew build`\n\nOn how to run the current plugin snapshot check on sample projects: `./gradlew ktlintCheck`\n\n### Running tests from [IDEA IDE](https://www.jetbrains.com/idea/)\n\nTo run tests in [IDEA IDE](https://www.jetbrains.com/idea/),\nfirstly you need to run following gradle task (or after any dependency change):\n\n```bash\n$ ./plugin/gradlew -p ./plugin pluginUnderTestMetadata\n```\n\nOptionally you can add this step test run configuration.\n\n## Links\n\n[Ktlint Gradle Plugin on the Gradle Plugin Registry](https://plugins.gradle.org/plugin/org.jlleitschuh.gradle.ktlint)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJLLeitschuh%2Fktlint-gradle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FJLLeitschuh%2Fktlint-gradle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FJLLeitschuh%2Fktlint-gradle/lists"}