hey folks, i notice that detekt baselines don't h...
# detekt
s
hey folks, i notice that detekt baselines don't have any information about the location source of the current issues. I don't know if this was considered in the past and decided against, but I think it could lead to false positives. for example, if I take ForbiddenSuppress rule and I have
MaximumLineLength
forbidden and the baseline updated
Copy code
@Suppress("MaximumLineLength")
class Bar
If for any reason, I have to modify that suppress rule, to something like:
Copy code
@Suppress("MaximumLineLength", "RandomOtherRule")
class Bar
This entire line is going to be reported despite the fact that a new rule suppression is introduced, and the "already known" issue was not changed
b
If your concern is purely theorical: yes. The baseline can have false posties and negatives. It's completely impossible to identify all the issues that are in the code.
If you are too restrictive, like the line of code, any change will break your baseline. If you go the other way you may be allowing new issues. We try to find a middle ground with our implementation
It's not perfect because as I said that's impossible.
If your concern is not theorical, then I recommend you to open an issue talking about your use case. But the possible fixes will be for each rule.
👍 2
s
Hmm makes sense. Thanks for the explanation. I was mostly curious about the rationale since many other linters have the source of the errors in the baseline files. Your response makes sense in that, it makes it a bit brittle, and refactoring in the class may immediately trigger baseline issues to be reported
That said, the scenario that made me look into this is not theoretical. It's what I described in the original post. I'll raise an issue about it for discussion.
👍 1