igor.wojda
04/04/2023, 11:24 PMapp:build
task the detekt
task runs as well. How can I disable this behaviour?ephemient
04/04/2023, 11:30 PM./gradlew -x detekt app:build
Javier
04/05/2023, 1:26 AMbuild
runs check
which runs detekt
. It is usual that build runs almost everything, what are you trying to do? maybe you want to compile + test, so ./gradlew assemble test
would be enoughMustafa Ozhan
04/05/2023, 8:22 AMigor.wojda
04/05/2023, 10:52 AMcheck
(defined as check
task dependency) task is great idea. However this has one major downside - when PR checks build fail you can't instantly determine the reason of the failure - you have to you have to manually read through (usually very long) log file. The solution for this is to runn all check in parallel (see screenshot).
Other linters such as spotless
are solving this issue by introducing configuration parameter:
spotless {
isEnforceCheck = false
}
Instead of heaving dedicated parameter Detekt proposes disabling this check by filtering tasks:
tasks.named("check").configure {
this.setDependsOn(this.dependsOn.filterNot {
it is TaskProvider<*> && it.name == "detekt"
})
}
I am using Gradle conventions plugins to setup detekt and for me the above solution does not workephemient
04/05/2023, 11:31 AM--continue
so that Gradle runs as many tasks as it can even if some fail (only dependent tasks will be cancelled). the final build will still fail if there were any failures.
2. detekt emits reports so you can just grab those. and/or enable SARIF output, it shows up directly in the GitHub UI, https://detekt.dev/docs/introduction/reporting/#integration-with-github-code-scanningigor.wojda
04/05/2023, 11:39 AMignoreFailures
option).
The main issue here is lack of visibility - you have to dig deep to understand which check has failed and why (detekt in not the only verification task, so there is very long build log and bunch of reports).Javier
04/05/2023, 11:40 AMigor.wojda
04/05/2023, 11:41 AMJavier
04/05/2023, 11:41 AMigor.wojda
04/05/2023, 11:42 AMbuild
but this is redundant as build task fails because of detekt issue - I would like to have more separationJavier
04/05/2023, 11:42 AMephemient
04/05/2023, 11:42 AMJavier
04/05/2023, 11:43 AMephemient
04/05/2023, 11:44 AM--continue
helps reduce duplicated work. instead of having multiple jobs that all build the same code, just have one job that does as much as possible. Gradle can still work in parallel (although you need to enable configuration cache to get the full benefits)Javier
04/05/2023, 11:44 AMigor.wojda
04/05/2023, 11:49 AMJavier
04/05/2023, 11:51 AMigor.wojda
04/05/2023, 7:30 PMdetekt {
isEnforceCheck = false
}
https://github.com/detekt/detekt/issues/5965#issuecomment-1497392847