https://kotlinlang.org logo
#detekt
Title
# detekt
g

gammax

03/25/2020, 4:32 PM
I’m looking for an easy way to report warnings in Detekt (that are not going to fail the build). I know there is a
Severity.Warning
on the
Issue
class that I can set for each issue that I report on a my rule. The problem is that those issues are counted towards the total number of issues used to let Detekt fail or not. Anyone faced a similar scenario?
s

schalkms

03/25/2020, 4:53 PM
@gammax hey Nico. You can configure build failure thresholds for your custom detekt rule. With the following statements detekt does not count any finding reported by
myrule
. Please remember that the default weight is 1.
Copy code
build:
  weights:
    myrule: 0
More information can be found under https://arturbosch.github.io/detekt/failonbuild.html
HTH
g

gammax

03/25/2020, 4:54 PM
Awesome, thanks for the lead
s

schalkms

03/25/2020, 4:55 PM
you're welcome 🙂
t

taso

03/28/2020, 3:23 PM
Not a huge issue for us but I was also wondering about the same recently. We don't use detekts fail functionality and let it run over all modules. Then our CI system and Sonarqube integration parses the XML reports. The XML reports unfortunately does not even take the weights into account. All issues are categorized into error/warning and there is no way to configure that.
s

schalkms

03/28/2020, 6:49 PM
@taso okay, thanks for the feedback. What problem do you see with the XML reports? Are the weights not part of the report?
t

taso

03/28/2020, 7:46 PM
a

Artur Bosch

03/28/2020, 8:10 PM
So you want to keep track of "suppressed" issues which should not fail the build but be reported for the case someone wants to fix them (boy scout rule) ? - interesting feature for a quality monitoring tool 🙂
t

taso

03/28/2020, 10:17 PM
I didn't really think about that. I guess baseline helps that too.
Suppress should stay suppressed since they're sometimes false Positives that are suppressed. No need to show them anywhere
28 Views