Ignore concrete set of rules for certain block of codes / lines that match regex pattern

There are some rules that generate false positives for our own use cases although the one I have in mind should apply to a wider range of people. We mark these issues as “won’t fix” but they keep popping and I want a general solution that will automate this manual labor.
Hence the need to ignore some blocks of code for just a concrete rule. All other rules should still run for these blocks of code. I imagine this to be an addition to the already present feature of generally ignoring blocks of code that match certain patterns – besides the two inputs to match the beginning and end of a block of code, a new one can be added to list the rules to be ignored.
Alternatively, you can introduce a tool to build criteria to automatically resolve issues as “won’t fix”.

Our use case for this: the rule scanning for dereferencing null pointers in Java is based on the @Nullable annotation. However, then using the key holder interface to get the auto-generated, we are pretty sure it won’t return null as all tables have autogenerated key.


Welcome to the community!

I’m going to leave your larger topic for the Product Mangers to respond to. But on the question of your particular use case, is it truly a false positive? I.e. the issue should never be raised, for anyone? Or is this more of a “won’t fix” / false positive-in-your-particular-context? Because if it’s the former, I urge you to create a False Positive report with a reproducer.