Configure clang-tidy rules

Hello Team,

I want to test the readability-isolate-declaration rule for clang-tidy but the mentioned rule is not enabled.

Command format used to run the rule:
clang-tidy -checks=-* , readability-isolate-declaration

But this gives Error : no checks enabled.

When I tried going through the official documentation of clang-tidy this rule is available. Kindly could some one suggest on how to enable the above mentioned rule.

Regards,
Ravi…

Hi Ravi,

the syntax seems correct, but you want to remove spaces and possibly add quotes to ensure no shell substitutions are taking place.

clang-tidy -checks=’-*,readability-isolate-declaration’ /some/dir/foo.cpp
should do the trick.

It is definitely there for the latest build, checked by running:

$ ./bin/clang-tidy -checks=’*’ -list-checks | grep isolate

readability-isolate-declaration

Are you using a fresh build of clang-tidy? The check was added in r345735 in October 2018, it’s possible that some package managers still have a version built before that revision.