Detekt is a linter for Kotlin. detekt is composed of several linter commands.Documentation Index
Fetch the complete documentation index at: https://trunk-4cab4936-sam-gutentag-flaky-tests-new-monitors.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
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:
Auto Enabling
Detekt will never be auto-enabled. It must be enabled manually.Settings
Detekt supports the following config files:.detekt.yaml
.trunk/configs and trunk check will still find them. See Moving Linters for more info.
Usage Notes
Detekt is usually invoked through gradle, which allows specifying additional configuration inbuild.gradle. We do not yet automatically parse your Gradle scripts to infer your detekt configuration; instead, what we do is this:
detektinvokesdetekt-cliwith the--build-upon-default-configflag (this appears to be more common than the alternative).detekt-explicitinvokesdetekt-cliwithout the--build-upon-default-configflag.
.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:
./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.
Links
- Detekt site
- Detekt Trunk Code Quality integration source
- Trunk Code Quality’s open source plugins repo