I want to use clang-tidy to enforce the style guidelines of my company. I'm working on Windows 10. I've installed LLVM v6.0.1. Here's my test file:
class foo_bar
{
public:
foo_bar() = default;
private:
int bar_;
};
And here's the command line I'm running:
clang-tidy.exe -checks='-*,readability-identifier-naming' -config="{CheckOptions: [ {key: readability-identifier-naming.ClassCase, value: CamelCase} ]}" test.cpp -- -std=c++11
clang-tidy doesn't output any error (I was expecting an issue with the class name). I fail to see where my mistake is. Can anyone guide me?
I tried the same command line with the same file on Ubuntu 16.04.4 and I have the desired result:
1 warning generated.
C:\Users\Cyril\dev\clang_test\main.cpp:1:7: warning: invalid case style for class 'foo_bar' [readability-identifier-naming]
class foo_bar
^
It seems that clang-tidy on Windows has a problem with a combination of -checks
and -config
options.
You can actually put everything into -config
:
clang-tidy.exe -config="{Checks: '-*,readability-identifier-naming', CheckOptions: [ {key: readability-identifier-naming.ClassCase, value: CamelCase} ]}" test.cpp -- -std=c++11
This produces the desired output
X:\test.cpp:1:7: warning: invalid case style for class 'foo_bar' [readability-identifier-naming]
class foo_bar
^~~~~~~
FooBar
Tested on LLVM 6.0 on Windows.