clang-tidy treats namespace as global variable when using readability-identifier-naming

I am using clang-tidy to lint source code. In the file .clang-tidy i defined:

Checks: '-*,readability-identifier-naming'
CheckOptions:
...
  - { key: readability-identifier-naming.NamespacePrefix,               value: n1_        },
  - { key: readability-identifier-naming.GlobalVariablePrefix,          value: g1_        },
...

myHeader.h:

namespace n1_test
{
...
}

Linting this file with clang-tidy (tried 11.1.0, 13.0.0git(both compiled by myself) and 10.0.0(downloaded)) on Linux Mint 19.2 (Tina)

with:

clang-tidy-11.1.0 -export-fixes=fixes.txt /tmp/clangTest/mylib/source/myHeader.h -- -I/tmp/clangTest/myLib/source

results in:

 warning: invalid case style for global variable 'n1_test' [readability-identifier-naming]
namespace n1_test {
          ^~~~~~~~~~
          g1_n1_test

I don't understand why NamespacePrefix is not working and clang-tidy treats the namespace as a global variable. I also testest NamespaceCase and it isn't working to.

PS: According to the documentation this should work



Read more here: https://stackoverflow.com/questions/66275717/clang-tidy-treats-namespace-as-global-variable-when-using-readability-identifier

Content Attribution

This content was originally published by Chris at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: