How can I override settings from a global detekt s...
# detekt
n
How can I override settings from a global detekt settings in a module for a multi-module gradle build? Right now I have a
detekt-config.yml
in my root directory, and another `detekt-config.yml`in my module directory. To use both, I use
detekt { config = files("${project.rootDir}/detekt-config.yml", "detekt-config.yml") }
. Is there a better way which e.g. does not require to repeat the base config file name or perhaps even a
mergeConfigs: true
which will automatically merge these? I tried
detekt { config += files("detekt-config.yml") }
but that did not work.
g
Is there a better way which e.g. does not require to repeat the base config file name
You should be able to write a Gradle function (let’s call it
mergeBaseConfigWith
) that returns a
ConfigurableFileCollection
(is Gradle type) and do something like:
Copy code
detekt { config = mergeBaseConfigWith("detekt-config.yml") }
n
This would still require to have programmatic access to the root config file (or file name), which I don't think I have.