detekt

Additional

Language
Kotlin
Version
1.1.1 (Oct 12, 2019)
Created
Oct 24, 2016
Updated
Oct 19, 2019
Owner
Artur Bosch (arturbosch)
Contributors
egor-n
Artem Zinnatullin :slowpoke: (artem-zinnatullin)
Pavlos-Petros Tournaris (pavlospt)
rock3r
Janusz Bagiński (jbaginski)
Marc Prengemann (winterDroid)
sschuberth
scottkennedy
Nelson Osacky (runningcode)
BraisGabin
Serj Lotutovici (serj-lotutovici)
Rafael Toledo (rafaeltoledo)
Karol Wrótniak (koral--)
gitter-badger
Said Tahsin Dane (tasomaniac)
Niklas Baudy (vanniktech)
mnonnenmacher
mickele
Show all (100)100
Activity
Badge
Generate
Download
Source code

Show card

detekt

Meet detekt, a static code analysis tool for the Kotlin programming language. It operates on the abstract syntax tree provided by the Kotlin compiler.

Features

  • Code smell analysis for your Kotlin projects
  • Complexity reports based on lines of code, cyclomatic complexity and amount of code smells
  • Highly configurable rule sets
  • Suppression of findings with Kotlin's @Suppress and Java's @SuppressWarnings annotations
  • Specification of quality gates which will break your build
  • Code Smell baseline and whitelisting for legacy projects
  • Gradle plugin for code analysis via Gradle builds
  • Gradle tasks to use local IntelliJ distribution for formatting and inspecting Kotlin code
  • SonarQube integration
  • Extensibility by enabling incorporation of personal rule sets, FileProcessListener's and OutputReport's
  • IntelliJ integration
  • Unofficial Maven plugin by Ozsie

Project Website

Visit the project website for installation guides, release notes, migration guides, rule descriptions and configuration options.

Quick-Links

Quick Start ...

with command-line interface

  • git clone https://github.com/arturbosch/detekt
  • cd detekt
  • ./gradlew build shadowJar
  • java -jar detekt-cli/build/libs/detekt-cli-[version]-all.jar --help

with gradle

Gradle 4.9+ is required:

buildscript {
    repositories {
        jcenter()
    }
}

plugins {
    id("io.gitlab.arturbosch.detekt").version("[version]")
}

detekt {
    toolVersion = "[version]"
    input = files("src/main/kotlin")
    filters = ".*/resources/.*,.*/build/.*"
    baseline = file("my-detekt-baseline.xml") // Just if you want to create a baseline file.
}

See bintray for releases and artifactory for snapshots.

Adding more rule sets

detekt itself provides a wrapper over KtLint as a formatting rule set which can be easily added to the gradle configuration:

dependencies {
    detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:[version]"
}

Likewise custom extensions can be added to detekt.

Contributors

If you contributed to detekt but your name is not in the list, please feel free to add yourself to it!

Mentions

As mentioned in...

Integrations:

Credits