Hi, with my team we are currently trying to migrating the company project from ktlint to detekt. The project is an Android application with multiple flavors.
So far we managed to get it to work but we would like to have a better integration with our CI: we would like to dynamically run detekt only on certain flavors of the project. At first we thought this could be achieved using the standard gradle profiles, but we actually need to cherry-pick multiple directories all on the same level, to be analyzed. Since this is an Android project, it would be a lot easier to just have a task for each variant we have that knows exactly which files needs to be checked, the same way ktlint is currently doing (the image on the left is what our src folder looks like):

To achieve something like this, as far as I know, we need to provide a list of Kotlin files we want to check to detekt but, currently, detekt only support a single path to either a file or a directory.
Supporting multiple input files will allow also the autodetection of the sources for the Gradle plugin, the same way ktlint is doing, making the input parameter optional:
https://github.com/JLLeitschuh/ktlint-gradle/blob/master/plugin/src/main/kotlin/org/jlleitschuh/gradle/ktlint/KtlintPlugin.kt#L140
I will be happy to help for the autodetect of the source changes for the Gradle plugin but, before that, detekt-cli needs to support a (large) list of files provided as input parameter.
Please let me know if you are interested in this topic and if the multiple files input can be added to detekt-cli.
Ktlint and detekt are complementary. There's no need to 'migrate' from one to another.
The work in #771 already tackles part of the problem to allow for a list of files as the input parameter.
e.g.: /first/file:/second/file:/third/file:/yet/another/file
@vanniktech I said "migrating" because we are dropping ktlint and we are adding detekt. The drop of ktlint is unrelated to the adoption of detekt. We are dropping it because, by design, ktlint doesn't provide an easy way to disable a specific rule and this is a deal breaker for us.
We wanted to use detekt in the past but we faced the problems with the multi file input and lack of build variants support.
@Mauin thanks, looks very promising :)
This is done, since detekt provides the --includes and --excludes flags.
Using globing patterns the use can include/exclude certain paths in the analysis.
Most helpful comment
The work in #771 already tackles part of the problem to allow for a list of files as the input parameter.
e.g.:
/first/file:/second/file:/third/file:/yet/another/file