Is there a reasonable way to emit a warning from a...
# detekt
w
Is there a reasonable way to emit a warning from a custom detekt rule?
g
short answer: no
w
okay! No problem
I just added a superclass to my custom rules that has such a
checkConfig
method that I call
it would be neat to add such a function to the
Rule
class. Would you accept such a PR?
g
long answer: So you can technically report an issue, and specify
Severity.Warning
in the severity.
w
That seems like a good way to implement a log message in the config, thanks!
g
Just to clarify my initial
no
: This
Severity.Warning
that you can specify in the custom rule, is not playing any role in the detekt inspection result other than any other rule.
w
right
completely understood
g
In other words: a
Severity.Warning
will let your build fail as much as any other rule will do. Is more like a "label" that you can have to inform the user.
w
yeah, I don't want to fail the build. I just want to alert the user that their configuration might not be exactly what they wanted
g
👆 that's exactly the opposite of what I said 😅
w
okay, then perhaps I am misunderstanding
would you be open to a PR for somethign like a
checkConfig
method?
g
I'm not sure I follow you, but there is already configuration validation implemented in Detekt
w
sorry, I have to go afk for a minute, but I will explain when I return, if that's okay?
👍 1