Hi,
Currently using SonarQube Developer Edition 8.9.9 (build 56886) on C++ code.
I’ve noticed that SonarQube does not flag unused local class object variables. It seems like it should according to rule https://rules.sonarsource.com/cpp/RSPEC-1481. The rule only flags unused local primitive data type variables. For example, the variable x
below will be flagged by the rule but someObject
will not. As a test, I made the class MyClass
empty (i.e. no constructors, destructor, member variables, etc.) and only then it would be flagged. Am I missing something or is this a bug?
void someMethod()
{
const MyClass someObject;
const int x = 0;
}
Thanks