pinterest/ktlint


An anti-bikeshedding Kotlin linter with built-in formatter https://pinterest.github.io/ktlint/

Download


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"]]
        
        

Readme


<h1 align="center"> <a href="https://pinterest.github.io/ktlint/"> <img src="https://cloud.githubusercontent.com/assets/370176/26518284/38b680da-4262-11e7-8d27-2b9e849fb55f.png"/> </a> </h1> <p align="center"> <a href="https://kotlinlang.slack.com/messages/CKS3XG0LS"><img src="https://img.shields.io/badge/slack-@kotlinlang/ktlint-yellow.svg?logo=slack" alt="Join the chat at https://kotlinlang.slack.com"/></a> <a href="https://github.com/pinterest/ktlint/actions/workflows/publish-snapshot-build.yml"><img src="https://github.com/pinterest/ktlint/actions/workflows/publish-snapshot-build.yml/badge.svg" alt="Build status"></a> <a href="https://search.maven.org/artifact/com.pinterest.ktlint/ktlint-cli"><img src="https://img.shields.io/maven-central/v/com.pinterest.ktlint/ktlint-cli.svg" alt="Maven Central"></a> <a href="https://jitpack.io/#pinterest/ktlint"><img src="https://jitpack.io/v/pinterest/ktlint.svg" alt="JitPack"></a> <a href="https://formulae.brew.sh/formula/ktlint"><img src="https://img.shields.io/homebrew/v/ktlint.svg" alt="HomeBrew"></a> <a href="LICENSE"><img src="https://img.shields.io/github/license/pinterest/ktlint.svg" alt="License"></a> <a href="https://pinterest.github.io/ktlint/"><img src="https://img.shields.io/badge/code%20style-%E2%9D%A4-FF4081.svg" alt="ktlint"></a> </p> <p align="center"> <a href="https://kotlinlang.org/">Kotlin</a> linter in spirit of <a href="https://github.com/standard/standard">standard/standard</a> (JavaScript) and <a href="https://golang.org/cmd/gofmt/">gofmt</a> (Go). </p>

Key features

  • No configuration required
  • Built-in Rule sets
  • Built-in formatter
  • .editorconfig support
  • Several built-in reporters: plain, json, html and checkstyle
  • Executable jar
  • Allows extension with custom rule sets and reporters

Quick start

Follow steps below for a quick start with latest ktlint release.

Documentation

<a href="https://pinterest.github.io/ktlint/">User guide</a>

Legal

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.