clang-tidy 忽略 Windows 上的可读性标识符命名
clang-tidy ignores readability-identifier-naming on Windows
我想使用 clang-tidy 来执行我公司的风格指南。我正在研究 Windows 10。我已经安装了 LLVM v6.0.1。
这是我的测试文件:
class foo_bar
{
public:
foo_bar() = default;
private:
int bar_;
};
这是我的命令行 运行:
clang-tidy.exe -checks='-*,readability-identifier-naming' -config="{CheckOptions: [ {key: readability-identifier-naming.ClassCase, value: CamelCase} ]}" test.cpp -- -std=c++11
clang-tidy 没有输出任何错误(我原以为 class 名称有问题)。我看不出我的错误在哪里。谁能指导我?
我在 Ubuntu 16.04.4 上用相同的文件尝试了相同的命令行,我得到了想要的结果:
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
^
Windows 上的 clang-tidy 似乎对 -checks
和 -config
选项的组合有问题。
你实际上可以把所有东西都放进去 -config
:
clang-tidy.exe -config="{Checks: '-*,readability-identifier-naming', CheckOptions: [ {key: readability-identifier-naming.ClassCase, value: CamelCase} ]}" test.cpp -- -std=c++11
这会产生所需的输出
X:\test.cpp:1:7: warning: invalid case style for class 'foo_bar' [readability-identifier-naming]
class foo_bar
^~~~~~~
FooBar
在 Windows.
上的 LLVM 6.0 上测试
如果您使用 Windows Cmd Shell (cmd.exe) 那么问题是在 -checks
选项中使用单引号 (')这条线
clang-tidy.exe -checks='-*,readability-identifier-naming' ....
如果您将其更改为(改为使用 ("))
clang-tidy.exe -checks="-*,readability-identifier-naming" ....
然后它将正常工作。
仅当 运行 在 cmd.exe
上使用 windows 时,这不是问题
我想使用 clang-tidy 来执行我公司的风格指南。我正在研究 Windows 10。我已经安装了 LLVM v6.0.1。 这是我的测试文件:
class foo_bar
{
public:
foo_bar() = default;
private:
int bar_;
};
这是我的命令行 运行:
clang-tidy.exe -checks='-*,readability-identifier-naming' -config="{CheckOptions: [ {key: readability-identifier-naming.ClassCase, value: CamelCase} ]}" test.cpp -- -std=c++11
clang-tidy 没有输出任何错误(我原以为 class 名称有问题)。我看不出我的错误在哪里。谁能指导我?
我在 Ubuntu 16.04.4 上用相同的文件尝试了相同的命令行,我得到了想要的结果:
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
^
Windows 上的 clang-tidy 似乎对 -checks
和 -config
选项的组合有问题。
你实际上可以把所有东西都放进去 -config
:
clang-tidy.exe -config="{Checks: '-*,readability-identifier-naming', CheckOptions: [ {key: readability-identifier-naming.ClassCase, value: CamelCase} ]}" test.cpp -- -std=c++11
这会产生所需的输出
X:\test.cpp:1:7: warning: invalid case style for class 'foo_bar' [readability-identifier-naming]
class foo_bar
^~~~~~~
FooBar
在 Windows.
上的 LLVM 6.0 上测试如果您使用 Windows Cmd Shell (cmd.exe) 那么问题是在 -checks
选项中使用单引号 (')这条线
clang-tidy.exe -checks='-*,readability-identifier-naming' ....
如果您将其更改为(改为使用 ("))
clang-tidy.exe -checks="-*,readability-identifier-naming" ....
然后它将正常工作。
仅当 运行 在 cmd.exe
上使用 windows 时,这不是问题