Static code analysis for Kotlin
marschwar and arturbosch [gradle plugin] test code refactoring (#1205)
* Decrease amount of boilerplate code in tests.

- Make tests more expressive.
- Use the same test code for groovy and kotlin dsl.

* Move manipulation before second run outside of check block.

* Change wording and indentation

* Increase the number of properties configured in a custom task config.
Latest commit 96cd5b2 Oct 20, 2018
Permalink
Failed to load latest commit information.
.buildscript Auto deploy SNAPSHOT versions. (#1088) Sep 9, 2018
.github Add new style multi-option issue templates (#1203) Oct 19, 2018
detekt-api Use private setter instead of separate backing field Oct 7, 2018
detekt-cli Add unnecessary apply rule (#1229) Oct 20, 2018
detekt-core Fix formatting issues (#1259) Oct 19, 2018
detekt-formatting Update ktlint (#1266) Oct 19, 2018
detekt-generator clarify error message in verify documentation task (#1202) Oct 17, 2018
detekt-gradle-plugin [gradle plugin] test code refactoring (#1205) Oct 20, 2018
detekt-rules Fix formatting Oct 20, 2018
detekt-sample-extensions Migrate JUnit tests to Spek (#1213) Oct 12, 2018
detekt-test Suppress false positive UnsafeCast in ThresholdedCodeSmellAssert.kt Oct 7, 2018
detekt-watcher Remove kotlinImplementation configuration from Gradle build Sep 24, 2018
docs Add unnecessary apply rule (#1229) Oct 20, 2018
gradle/wrapper Revert "Revert "Update dependencies"" Oct 3, 2018
reports Remove unused baseline (#1263) Oct 19, 2018
scripts Reference vcsreader repo via GrabResolver - Fixes #1101 Sep 13, 2018
.editorconfig Add .editorconfig Sep 14, 2017
.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 Travis: oraclejdk10 > openjdk10 Oct 18, 2018
LICENSE Update licence copyright date and authors - #176 Jul 9, 2017
README.md Add unnecessary apply rule (#1229) Oct 20, 2018
ROADMAP.md Update roadmap Mar 15, 2018
appveyor.yml AppVeyor: Disable Kotlin's incremental build support (#1240) Oct 12, 2018
build.gradle.kts Remove unused baseline (#1263) Oct 19, 2018
commit-msg Removed commit message length check from commit-hook Mar 20, 2018
gradle.properties Update ktlint (#1266) Oct 19, 2018
gradlew Update Gradle wrapper, using Gradle 4.1-rc-2 Aug 6, 2017
gradlew.bat Update Gradle wrapper, using Gradle 4.1-rc-2 Aug 6, 2017
idea-code-style.xml Update documents for RC2 Aug 12, 2017
settings.gradle.kts Revert "Revert "Update dependencies"" Oct 3, 2018

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/ build status build status windows Download gradle plugin

All Contributors 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 report based on logical lines of code, McCabe complexity and amount of code smells
  • Highly configurable
  • Suppress findings with Kotlin's @Suppress and Java's @SuppressWarnings annotations
  • Specify code smell thresholds to break your build
  • Code Smell baseline and ignore lists 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
  • Extensible by own rule sets, FileProcessListener's and OutputReport's
  • IntelliJ integration
  • Unofficial Maven plugin by Ozsie

Project Website

Visit https://arturbosch.github.io/detekt/ 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

buildscript {
    repositories {
        jcenter()
    }
}

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

detekt {
    toolVersion = "[version]"
    input = files("src/main/kotlin")
    filters = ".*/resources/.*,.*/build/.*"
}

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 {
    detekt "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