I have a particular function which breaks rule c:S1244 “Floating point numbers should not be tested for equality”. In this function, there is nothing at all wrong with testing for equality, so I want to exclude it from the rule. How do I do this exclusion without going and clicking on each instance in the SonarQube web site?
What I am really looking for is exclusion tags, e.g.
I guess you don’t want to have to mark it Won’t Fix / Accepted across branches?
While you can turn off specific rules for specific files, your best bet is probably to use a //NOSONAR comment on the line where the issues is raised. Note that this will suppress all issues on the line, not just this one. But it happens at the code level, so it will take effect across (all future) branches.
Per the docs, sonar.issue.ignore.block ignores all issues within the block not just your selected one, and it requires you to denote the blocks with begin and end strings. It’s intended to allow you to exclude blocks of generated code within a file. I don’t believe it’s appropriate for your situation.
There’s been some discussion on this topic, but I’m not aware of a timeline.
This function signature is autocoded to conform to a certain interface. There is little I can do about its parameters. Unfortunately, it is falling foul of " The order for arguments of the same type in a function call should be obviouscpp:S5419".
I understand the rule, and I would not want to disable it generally, but also, this warning will arise again and again in these interface-conformant autocoded function signatures. It is so onerous to have to open up the browser to deal with these issues when you know that these function signatures categorically will not satisfy the rule.
Thank you for your contribution. We are painfully aware of the actual behavior of NOSONAR which is… less than desirable.
This is a topic of discussion right now, to see in which direction we need to go with this. This use-case will feed into our discussion.