sanogueralorenzo
11/09/2019, 1:24 AMplugins {
id "io.gitlab.arturbosch.detekt" version "1.1.1"
}
dependencies {
detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.1.1"
}
task detektAll(type: io.gitlab.arturbosch.detekt.Detekt) {
description = "Runs detekt for the entire project."
input = files("$projectDir")
config = files("$rootDir/config/detekt/detekt.yml")
parallel = false
includes = ["**/*.kt", "**/*.kts"]
excludes = ["**/resources/**", "**/build/**", "**/buildSrc/**", "**/test/**/*.kt"]
baseline = file("$rootDir/config/detekt/baseline.xml")
reports {
xml { enabled = false }
html { enabled = false }
txt { enabled = false }
}
}
The detektFormat has disableDefaultRuleSets
& buildUponDefaultConfig
which I'm not sure if I should apply.
Also noticed that there is no need for a detekt format task if you just set autoCorrect
to true in the detektAll
Only thing I find a bit confusing is that if it can fix all the issues it will fix them but still fail. While on ktlintFormat it would only fail if it is not able to fix any of the issues. The reason I say it is confusing is because I can have 5 issues that only 3 have been fixed but all will be marked as failure. Which leaves the developer in the situation to not know for which ones to look because some of them might have already been fixed.
On the other hand for CI this is great because even if it is able to fix them it will fail and sends a clear message of: you have detektIssues run it locally, commit & pushFrodrigues
11/09/2019, 11:52 AMbuildUponDefaultConfig
is when you change some rules in your detekt.yml and you don't want to put every ruledisableDefaultRuleSets
is when you don't want detekt to use the default rules and so you have to put every rule in your config fileMike
11/09/2019, 2:30 PMsanogueralorenzo
11/09/2019, 4:07 PM