C++ 为什么铿锵整洁的可读性隔离声明不修复代码?

C++ 为什么铿锵整洁的可读性隔离声明不修复代码?,c++,clang-tidy,C++,Clang Tidy,我试着在ClangTidy中使用可读性隔离声明检查,但没有解决任何问题。test.cpp文件中的代码示例: void f() { int a = 0, b = 1, c = 2; } 我所做的: clang-tidy -checks='readability-isolate-declaration' -fix test.cpp 输出: Error while trying to load a compilation database: Could not auto-detect co

我试着在ClangTidy中使用可读性隔离声明检查,但没有解决任何问题。test.cpp文件中的代码示例:

void f() {
    int a = 0, b = 1, c = 2;
}
我所做的:

clang-tidy -checks='readability-isolate-declaration' -fix test.cpp
输出:

Error while trying to load a compilation database:
Could not auto-detect compilation database for file "test.cpp"
No compilation database found in /home/anzipex/Downloads/clang-test or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
void f() {
    int a = 0;
    int b = 1;
    int c = 2;
}

这里有几个问题:

  • 可读性隔离声明
    检查在clang tidy 6中不存在。升级到最新版本
  • 如果没有编译数据库,可以使用
    --
    (双破折号)指定编译选项。即使指定“无”,这也会告诉clang tidy编译该文件。看
  • 你没有告诉clang tidy排除你想要的支票之外的其他支票
  • 这是命令的外观:

    clangtidy-checks='-*,可读性隔离声明'test.cpp-fix--

    输出:

    Error while trying to load a compilation database:
    Could not auto-detect compilation database for file "test.cpp"
    No compilation database found in /home/anzipex/Downloads/clang-test or any parent directory
    fixed-compilation-database: Error while opening fixed database: No such file or directory
    json-compilation-database: Error while opening JSON database: No such file or directory
    Running without flags.
    
    void f() {
        int a = 0;
        int b = 1;
        int c = 2;
    }
    
    “ClangTidy--version”显示LLVM版本6.0.0