Created
August 18, 2022 15:07
-
-
Save laithnurie/71f0cfa75b2bd81655f62d3d930b0965 to your computer and use it in GitHub Desktop.
Detekt gradle methods
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tasks.register('detektFix', io.gitlab.arturbosch.detekt.Detekt) { | |
description = "Runs over whole code base without the starting overhead for each module." | |
autoCorrect = true | |
parallel = true | |
setSource(files(projectDir)) | |
include("**/*.kt") | |
include("**/*.kts") | |
exclude("**/resources/**") | |
exclude("**/build/**") | |
exclude("**/test/**/*.kt") | |
config.from(files("$rootDir/config/detekt/detekt.yml")) | |
// point to your custom config defining rules to run, overwriting default behavior | |
baseline.set(file("$rootDir/config/detekt/detekt-baseline.xml")) | |
// a way of suppressing issues before introducing detekt | |
failFast = true // fail build on any finding | |
buildUponDefaultConfig = true // preconfigure defaults | |
reports { | |
xml.enabled = false | |
html.enabled = true | |
} | |
} | |
tasks.register('detektCheck', io.gitlab.arturbosch.detekt.Detekt) { | |
description = "Runs over whole code base without the starting overhead for each module." | |
autoCorrect = false | |
parallel = true | |
setSource(files(projectDir)) | |
include("**/*.kt") | |
include("**/*.kts") | |
exclude("**/resources/**") | |
exclude("**/build/**") | |
exclude("**/test/**/*.kt") | |
config.from(files("$rootDir/config/detekt/detekt.yml")) | |
// point to your custom config defining rules to run, overwriting default behavior | |
baseline.set(file("$rootDir/config/detekt/detekt-baseline.xml")) | |
// a way of suppressing issues before introducing detekt | |
failFast = true // fail build on any finding | |
buildUponDefaultConfig = true // preconfigure defaults | |
reports { | |
xml.enabled = false | |
html.enabled = true | |
} | |
} | |
tasks.register('detektAllBaseline', io.gitlab.arturbosch.detekt.DetektCreateBaselineTask) { | |
description = "Overrides current baseline." | |
ignoreFailures.set(true) | |
parallel.set(true) | |
setSource(files(rootDir)) | |
config.from(files("$rootDir/config/detekt/detekt.yml")) | |
// point to your custom config defining rules to run, overwriting default behavior | |
baseline.set(file("$rootDir/config/detekt/detekt-baseline.xml")) | |
// a way of suppressing issues before introducing detekt | |
include("**/*.kt") | |
include("**/*.kts") | |
exclude("**/build/**") | |
exclude("**/buildSrc/**") | |
exclude("**/test/**/*.kt") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment