Detekt
Last updated
Last updated
is a linter for Kotlin.
detekt is composed of several linter commands.
detekt
runs detekt with the built-in default config and any overrides in .detekt.yaml
.
You can enable the detekt
linter with:
detekt-explicit
disables the default config and uses .detekt.yaml
as the source of truth.
You can enable the detekt-explicit
linter with:
detekt-gradle
runs detekt using Gradle. Only use if you already are using Gradle for the rest of your build setup.
You can enable the detekt-gradle
linter with:
Detekt will never be auto-enabled. It must be enabled manually.
Detekt supports the following config files:
.detekt.yaml
Detekt is usually invoked through gradle, which allows specifying additional configuration in build.gradle
. We do not yet automatically parse your Gradle scripts to infer your detekt
configuration; instead, what we do is this:
You will also need to provide a valid detekt config as .detekt.yaml
(an empty .detekt.yaml
is valid, if you don't want to configure detekt
). If you already have a detekt config, then you can symlink it like so:
To use ./gradlew detekt
to invoke Detekt, you can add detekt-gradle@SYSTEM
to your enabled
list. Note that since you're running Detekt via Gradle, you should also add the paths to your Detekt configurations to direct_configs
, e.g.
You can move these files to .trunk/configs
and trunk check
will still find them. See for more info.
detekt
invokes with the --build-upon-default-config
flag (this appears to be than the alternative).
detekt-explicit
invokes without the --build-upon-default-config
flag.
Detekt Trunk Code Quality
Trunk Code Quality's