cpp:S1000 Header files should not contain unnamed namespaces in with C++ modules (C++23)

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.
export module MyModule1::MyPartition1; 

import MyLogging;

namespace
{
    const auto logger = ...
}

namespace MyNameSpace1
{
   export class ... {
       ...
       logger->LogError(...)
       ...
  } 
}

The same issue is reported, if the anonymous namespace is placed inside

namespace MyNameSpace1
{
   namespace
   {
       const auto logger = ...
   }
   ....  
}