How can I custom my rules when running detekt using Gradle Task. #6566
-
my detekt gradle task is like this: def detektTask = tasks.register("ktlint", JavaExec) {
main = "io.gitlab.arturbosch.detekt.cli.Main"
classpath = configurations.detekt
def input = project.hasProperty("detektPath") ? project.detektPath : ""
if (input == null || input.isEmpty()) {
input = "$projectDir"
}
def config = "$projectDir/detekt/detekt-config.yml"
def baseline = "$projectDir/detekt/baseline.xml"
def exclude = "**/build/**,**/resources/**,**/RetouchMiddleware/**"
def report = "html:build/reports/detekt.html"
def params = [
'-i', input,
'-c', config,
'-b', baseline,
'-ex', exclude,
'-r', report,
'--parallel'
]
println("start detekt")
args(params)
} However, all the custom rules examples I have seen are based on the Detekt Gradle plugin. |
Beta Was this translation helpful? Give feedback.
Answered by
cortinico
Oct 26, 2023
Replies: 1 comment 3 replies
-
You can do so by using the |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
cortinico
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can do so by using the
--plugins
(or-p
) flag of the CLI. See more about it here:https://detekt.dev/docs/next/gettingstarted/cli/#use-the-cli