How to inline suppress cpp:S4963 (rule of zero)

I am using Developer Edition Version 9.9.1 (build 69595).

I get the code smell cpp:S4963 (“Remove this class’ destructor so that the class follows the rule of Zero.”). I am logging in this destructor so I want to keep it. I tried to put a // NOSONAR on the line where the destructor starts in the .cpp file, but it is being ignored. I noticed that the line where SonarQube indicates the smell is the start of the class definition in the header file. I don’t want to put the suppression there, because I fear it might suppress other issues in the future. What is the correct way to do this?

By the way, I tried to do the suppressions on the web UI, because the inline suppression support is so poor in SonarQube and although I prefer to see the suppressions in the code. But every time I created a new feature branch, all the issues showed up again. So this is not a workable solution.

Hi,

You’re right about that. // NOSONAR suppresses all issues on the line. The cleanest way to do this is probably a multicriteria exclusion.

 
HTH,
Ann