False positive on non-code comment considered code in C++


SonarLint SonarSource
Clion 2021.1.3
Ubuntu 20.04.3 LTS

The middle line of the following 3 line comment is considered code by SonarLint and triggers the rule to remove commented code cpp:commentedCode. Please adjust the heuristic to not consider such text as code.

// This atomic flag will be set to true strictly after the value is evaluated and set. When checking it, you may get
// a false negative, that is the flag being false, but the value already evaluated, but never a false positive.
// This makes it safe to check the flag, and avoid the mutex when it is true.

Hello @shojtsy,

This rule has many limitations, it needs redesigning. I suggest disabling it if it creates a lot of noise until we implement a better version.


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