Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.shyiko:ktlint:0.36.0'
}
dependencies {
implementation("com.github.shyiko:ktlint:0.36.0")
}
<dependency>
<groupId>com.github.shyiko</groupId>
<artifactId>ktlint</artifactId>
<version>0.36.0</version>
</dependency>
libraryDependencies += "com.github.shyiko" % "ktlint" % "0.36.0"
:dependencies [[com.github.shyiko/ktlint "0.36.0"]]
.editorconfig
supportplain
, json
, html
and checkstyle
Follow steps below for a quick start with latest ktlint release.
Step 1: Install with brew
brew install ktlint
See download and verification from GitHub or other package managers for alternative ways of installing ktlint. Or, use one of the integrations like maven and gradle plugins.
Step 2: Lint and format your code
All files with extension .kt
and .kts
in the current directory and below will be scanned. Problems will be fixed automatically when possible.
ktlint --format
# or
ktlint -F
See cli usage for a more extensive description on using ktlint.
<a href="https://pinterest.github.io/ktlint/">User guide</a>
This project is not affiliated with nor endorsed by JetBrains.
All code, unless specified otherwise, is licensed under the MIT license.
Copyright (c) 2019 Pinterest, Inc.
Copyright (c) 2016-2019 Stanley Shyiko.