Connect with us

Code

Ktlint – An anti-bikeshedding Kotlin linter with built-in formatter

Spending time on configuration (& maintenance down the road) of hundred-line long style config file(s) is counter-productive. Instead of wasting your energy on something that has no business value – focus on what really matters (not debating whether to use tabs or spaces).

By using ktlint you put the importance of code clarity and community conventions over personal preferences. This makes things easier for people reading your code as well as frees you from having to document & explain what style potential contributor(s) have to follow.

ktlint is a single binary with both linter & formatter included. All you need is to drop it in (no need to get overwhelmed while choosing among dozens of code style options).

Features

  • No configuration.* Which means no decisions to make, nothing to argue about and no special files to manage.
    While this might sound extreme, keep in mind that ktlint tries to capture (reflect) official code style* from kotlinlang.org and Android Kotlin Style Guide (+ we respect your .editorconfig and support additional ruleset|s).
  • Built-in formatter. So that you wouldn’t have to fix all style violations by hand.
  • Customizable output. plain (+ plain?group_by_file), jsonhtml and checkstyle reporters are available out-of-the-box. It’s also easy to create your own.
  • A single executable jar with all dependencies included.
Ktlint on GitHub: https://github.com/pinterest/ktlint
Platform: Kotlin/Android
⭐️: 4.9K
Advertisement

Trending