How to enable specific SonarQube check on godbolt.org?

I believe I have found an example of a false-positive for a rule that is not part of the default Sonar Way ruleset (cpp:S835).

Before reporting the problem, I would like to create a minimum working example using godbolt.org, as in this thread.

According to this answer, it is possible to enforce specific rules in the CLI scanner “using an internal option”. Could someone please specify what that option is, so that I can try to reproduce my issue on godbolt.org?

Many Thanks

1 Like

Hi @m2427, nice to see you again!

Thanks for taking the time to research related posts on the community, and to trying to write a minimal working example. This really helps!

The internal option is --enable-rules= which takes a comma-separated list of additional rules to enable. Here is a CE link from the linked post with S835 enabled.

It may be worth mentioning here that there is currently no publicly available way to get the version of the deployed analyzer on godbolt, and it may not match the behavior of the analyzer version you have on SonarQube or SonarLint.

From my perspective, CE links are a very valuable tool in discussions to quickly demonstrate the behavior one is describing, but for reducing examples, I would start by using SonarLint locally (to make sure I am starting with a version that has the property I am testing for).

Also, you can always generate a reproducer file for the translation unit that raises the false positive you encountered, and we can try to reduce it on our end…

Best regards,
Michael

3 Likes

Thank you very much. I was able to reproduce my issue this way - I will create a separate thread for it.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.