ktlint

Version: 1.8.0darwinlinuxwindows

No configuration required

ktlint aims to capture the Kotlin coding conventions and Android Kotlin Style Guide. In some aspects ktlint is a bit more strict*.

Rule sets

ktlint offers a standard rule set. Next to this, it is easy to provide custom rule sets.

.editorconfig

Some rules do allow further configuration, but in all cases a reasonable default is set when not provided. ktlint primarily uses the .editorconfig file to read default .editorconfig, IntelliJ IDEA specific and Ktlint specific properties.

Disable rules

If need be, rules can be disabled easily*.

Built-in formatter

Most lint violations don’t need to be fixed manually. ktlint has a built-in formatter which fixes violations when possible. Some violations can not be fixed in a deterministic way, and need manual action.

Customizable output

Several reporters are available out-of-the-box: plain (+ plain?group_by_file), plain-summary, json, html and checkstyle. It’s also easy to create a custom reporter.

Executable jar

ktlint is released as a single executable jar with all dependencies included.

Installation Instructions

Linux

Download Ktlint
{
  "url": "{{ .SVar `.tool.ktlint.download.url` }}",
  "destination_folder": "{{ .PDownloads }}",
  "output_filename": "{{ .SVar `.tool.ktlint.download.filename` }}",
  "overwrite": false
}
Copy executable
{
  "source": "{{ .PDownloads }}/{{ .SVar `.tool.ktlint.download.filename` }}",
  "destination": "{{ .PTools }}/ktlint/{{ .SVar `.tool.ktlint.download.version` }}/ktlint"
}
Make sure artefact is executable
{
  "path": "{{ .PTools }}/ktlint/{{ .SVar `.tool.ktlint.download.version` }}/ktlint",
  "permission_bits": 504
}

MacOS

Download Ktlint
{
  "url": "{{ .SVar `.tool.ktlint.download.url` }}",
  "destination_folder": "{{ .PDownloads }}",
  "output_filename": "{{ .SVar `.tool.ktlint.download.filename` }}",
  "overwrite": false
}
Copy executable
{
  "source": "{{ .PDownloads }}/{{ .SVar `.tool.ktlint.download.filename` }}",
  "destination": "{{ .PTools }}/ktlint/{{ .SVar `.tool.ktlint.download.version` }}/ktlint"
}
Make sure artefact is executable
{
  "path": "{{ .PTools }}/ktlint/{{ .SVar `.tool.ktlint.download.version` }}/ktlint",
  "permission_bits": 504
}

Binaries