Open andrejusc opened 2 years ago
Each checker in the Checker Framework already has a unique prefix, such as "nullness:" or "resourceleak:". See https://checkerframework.org/manual/#suppresswarnings-annotation-syntax . You can use "allcheckers:" to mean all checkers, though -- for the reasons you noted -- it can be more informative to use a checker-specific prefix.
@mernst - maybe I didn't explain my ask clearly enough. What I want/need to have is such:
@SuppressWarnings("checker:nullness:assignment")
So instead of grepping code for nullness:
prefix as one of many possible checkers related things - I could grep for global "checker:" prefix and know that every other things after that is Checkers related.
How to achieve that?
What you are requesting is currently not possible. You could submit a patch to enable it, though we generally try not to add features that are not needed by multiple users.
Another alternative would be to put the tag you desire in a comment, like so:
@SuppressWarnings("nullness:assignment") // Checker Framework
That would enable the grep you want, without the need to change the warning suppression key.
@mernst - to this your point: "What you are requesting is currently not possible." - this issue is essentially Enh./Feature request and that is why I was suggesting to have extra argument, so could be potentially introduced in not so hard way.
I'd like to avoid extra commenting needed in source code just to depict some warnings' "namespace".
I'm going to close this issue for now. As I mentioned, we are open to a pull request if you would like to contribute an implementation of this feature.
For a Java project, which uses both Checkstyle and Checkers Framework, there is a need for ease of maintenance and gradual code quality improvements to differentiate in easy way which Suppressions belong to which part.
For checkstyle example is such identifiable by "checkstyle:" prefix:
For Checkers FW (without usage of
-ArequirePrefixInWarningSuppressions
flag) is such:and so for Checkers FW would like to have some dedicated flag like:
and/or have that by default to be handled by Checkers FW if specified inside @SuppressWarnings clause.