Suppressing targeted rules

My team would like very much like to be able to identify the rule to be suppressed in the NOSONAR comment, otherwise all rules are suppressed.

For example, clang-tidy allows:

foo(); // NOLINT(readability-magic-numbers, bugprone-suspicious-call-argument)

As you can see, there is the directive and also qualified rules. All other rules remain in effect.

I think there is a feature request ticket but I have not seen any discussion of this being put on the roadmap. Can this be put on the roadmap?

Hey @SQ-MedicalUser, I know this has been done for Python, but don’t think there’s any specific item in the roadmap for C/C++. I can see you also posted in this other thread, which is which seems more lively and engaged on this particular topic, so I suggest we let other users and potentially our team follow up in that thread instead of this one.

Hi @SQ-MedicalUser,

I moved your question to a new topic, since resurrected thread are not that visible.

Since a few versions, we support sonar-resolve in our analyzer for C and C++. I think that if you read the documentation, you’ll find it is a good fit for what you want to do.

The main other difference with NOSONAR is that the issue will still be reported, but immediately accepted. This allows you, for instance, to generate a report of all cases where sonar-resolve is used.