Integrate SonarQube with your AI agent, scan for secrets and dependency risks, and explore and manage issues—all from the command line.
Start using SonarQube CLI
Template for a good new topic, formatted with Markdown:
ALM used:Azure DevOps
CI system used: Azure DevOps, self hosted agent
Scanner command used when applicable: SonarCloudAnalyze@4.2.5
Languages of the repository C++23, C#
Error observed (wrap logs/code around with triple quotes ``` for proper formatting)
Steps to reproduce
To keep the logger local to the tranlsation unit, it is defined in an anonymous workspace inside the ixx module partion file. This is reported as Add a name to this namespace.
Apologies for the late reply and thanks for reporting this issue.
I was able to reproduce it on my side with the following minimal example:
// Module.cppm
export module mod;
namespace { // FP S1000:Add a name to this namespace.
}
// Implementation.cpp
module mod;
To clarify. Does your module interface unit also have a corresponding module implementation unit? From my debugging, this is the necessary condition to trigger this false positive.
In any case, I’ve created a ticket to fix this. But let me know if your case is actually different.
Upon further discussion with @milbrandt in private chat, it was confirmed that the FP can be reproduced with two conditions:
the unnamed namespace is inside a C++ module unit, and
that module unit is being analyzed while analyzing a different translation unit, rather than as the main analyzed file, which typically happens when the module is imported.
A fix has been prepared and will be available in the next release.