A common use case of detekt users was to build upon the default config file and use a second config file to override some defaults. Speaking in Gradle terms, this could look like following:
detekt {
...
config = files(
project.rootDir.resolve("config/default-detekt-config.yml"),
project.rootDir.resolve("config/our.yml")
)
baseline = project.rootDir.resolve("config/baseline.xml")
...
}
Starting from RC13, two new commandline flags got introduced:
--fail-fast- and
--build-upon-default-config - (
buildUponDefaultConfigandfailFastproperties for gradle setup)
Both options allow us to use the distributed default-detekt-config.yml as the backup configuration when
no rule configuration is found in the specified configuration (--config or config = ...).
This allows us to simplify our detekt setup without copy-pasting a huge config file:
detekt {
...
buildUponDefaultConfig = true
config = files(project.rootDir.resolve("config/our.yml"))
baseline = project.rootDir.resolve("config/baseline.xml")
...
}
{% include links.html %}