Another Question: Can I create a `baseline.xml` o...
# detekt
Another Question: Can I create a
of all the issues that are already suppressed via annotations in the code? Why? - I am looking to get some insight into what how many modules are suppressing errors in code (and not in a baseline file). I want the ability to inspect that baseline information in a single place instead of searching all around the code. Hacky ways I could do this (that's why I'm looking for a better way): 1. Delete all the
annotations first, and then run
, but it would be challenging to do that at scale, and would might cause other formatting issues. 2. Add a custom metric to collect the total number of suppressions in a module. While this is useful, I'd want to break it down by the rule they are suppressing. In order to do that I'd need to create multiple rules for each type of suppressed rule. Additionally, this wouldn't tell me what file it's in, just a total count. 3. I could create a rule that creates a code smell for every
annotation encountered. That should at least create a list that can be inspected. I'd have the same problem with option 2 since I don't believe it would group them by the contents of the annotation, but I could add that to my messaging and process that later on? Thanks again.
If you want accurate number of issues I don't recommend you to use the baseline. Multiple issues could hide behind a single issue entry. It's not normal but it can happen. This is a limitation really difficult to avoid because there is no way to find an universal id for each issue and keep that id even when you refactor code around that issue.
I think that the best option is the second. You can store any arbitrary value inside a
so there is not need to create a processor per rule. The how is explained there:
thank you color 1
Thanks. I was able to do this and it worked great 🙂 . It's not open source at the moment, but hopefully in the near future.
❤️ 1