I tried to use readability-isolate-declaration check in clang-tidy, but nothing fixed. Example of code from test.cpp file:
void f() {
int a = 0, b = 1, c = 2;
}
What I've done:
clang-tidy -checks='readability-isolate-declaration' -fix test.cpp
Output:
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.
There are several problems here:
readability-isolate-declaration
check didn't exist in clang-tidy 6. Upgrade to a more recent version--
(double dash) to specify compilation options. Even if you specify none, this will tell clang-tidy to compile the file. See the documentation.This is what the command should look like:
clang-tidy -checks='-*,readability-isolate-declaration' test.cpp -fix --
Output:
void f() {
int a = 0;
int b = 1;
int c = 2;
}