Skip to content
Static code analysis for Kotlin
Kotlin Other
  1. Kotlin 99.5%
  2. Other 0.5%
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.buildscript Deploy SNAPSHOTs automatically (#2079) Nov 8, 2019
.github Prepare 1.1.0 release (#1919) Oct 5, 2019
config/detekt Validate yaml configurations by comparing their structure - #516 (#1998) Nov 3, 2019
detekt-api Deprecate properties on Entity - Closes #2014 (#2072) Nov 3, 2019
detekt-cli Activate more rules by default - #1911 (#2075) Nov 11, 2019
detekt-core Fix issues running detektMain/detektTest tasks (#2069) Oct 29, 2019
detekt-formatting Enable more rules in failfast (#1935) Oct 15, 2019
detekt-generator Validate yaml configurations by comparing their structure - #516 (#1998) Nov 3, 2019
detekt-gradle-plugin Update dependencies (#2031) Oct 29, 2019
detekt-rules Activate more rules by default - #1911 (#2075) Nov 11, 2019
detekt-sample-extensions Convert tabs in multiline strings to 4 spaces (#1960) Sep 29, 2019
detekt-test Improve text location: MatchingDeclarationName (#2062) Nov 2, 2019
docs Report InvalidRange for empty until range (#2074) Nov 5, 2019
gradle/wrapper Update dependencies (#2031) Oct 29, 2019
scripts Prepare 1.0 (#1802) Aug 8, 2019
.codecov.yml Remove MacOS JDK11 CI run as discussed in #2015 (#2056) Oct 27, 2019
.editorconfig Reformat code base with KtLint + IntelliJ (KDoc) Feb 9, 2019
.gitattributes Checkout *.md, *.yml & *.html with LF line endings Dec 13, 2017
.gitignore Allow importing just detekt-gradle-plugin into IDE Oct 2, 2018
.travis.yml Remove MacOS JDK11 CI run as discussed in #2015 (#2056) Oct 27, 2019
LICENSE Update licence copyright date and authors - #176 Jul 9, 2017
README.md Add license badge to README (#2080) Nov 11, 2019
ROADMAP.md Prepare 1.1.0 release (#1919) Oct 5, 2019
appveyor.yml Don't build twice when PR created from branch (#1866) Sep 12, 2019
build.gradle.kts Fix issues running detektMain/detektTest tasks (#2069) Oct 29, 2019
gradle.properties Update dependencies (#2031) Oct 29, 2019
gradlew Gradle 5.6 (#1833) Aug 25, 2019
gradlew.bat Gradle 5.6 (#1833) Aug 25, 2019
settings.gradle.kts Prepare 1.1.0 release (#1919) Oct 5, 2019

README.md

detekt

Join the chat at https://kotlinlang.slack.com/messages/C88E12QH4/convo/C0BQ5GZ0S-1511956674.000289/ Visit the website at https://arturbosch.github.io/detekt/ Download gradle plugin

build status build status windows codecov CodeFactor FOSSA Status Awesome Kotlin Badge

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

detekt in action

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

androidweekly androidweekly

As mentioned in...

Integrations:

Credits

You can’t perform that action at this time.