Skip to main content

Run detekt using Command Line Interface

Install the cli

There are different ways to install the Command Line Interface (CLI):

MacOS, with Homebrew:

brew install detekt
detekt [options]

Any OS:

info

The latest released version of Detekt is 1.20.0

curl -sSLO https://github.com/detekt/detekt/releases/download/v[detekt_version]/detekt-cli-[detekt_version].zip
unzip detekt-cli-[detekt_version].zip
./detekt-cli-[detekt_version]/bin/detekt-cli --help

Use the cli

detekt will exit with one of the following exit codes:

Exit codeDescription
0detekt ran normally and maxIssues count was not reached in BuildFailureReport.
1An unexpected error occurred
2MaxIssues count was reached in BuildFailureReport.
3Invalid detekt configuration file detected.

The following parameters are shown when --help is entered.

{% include_relative cli-options.md %}