[PATCH] D38171: Implement clang-tidy check aliases.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 06:08:46 PDT 2017

alexfh added a comment.

In https://reviews.llvm.org/D38171#878814, @lebedev.ri wrote:

> On a somewhat related  note, since this is already talking about aliases
> I feel like the current handling of the clang-tidy check aliases needs adjusting.
>  If one enables all the checks (`Checks: '*'`), and then disables some of them
>  on check-by-check basis,

Clang-tidy allows doing so, but I doubt this is a use case we want to encourage. At least, not for a day-to-day use. Most checks require a certain amount of work on the target code and sometimes fine tuning of the check options to be useful for any real codebase. Apart from that, there are checks that give duplicate warnings (some are aliases and some just cover intersecting set of issues), and there are checks that can give conflicting advice. These facts don't combine well with the "enable almost all checks" use case and limit its area of applicability to stress-testing clang-tidy and maybe to initial evaluation of clang-tidy checks on a certain codebase (though going from the other direction and determining the set of style rules for the codebase and then finding which of those are implemented in clang-tidy is a more fruitful approach).

> if the disabled check has aliases
>  (`cppcoreguidelines-pro-type-vararg` vs `hicpp-vararg`, `hicpp-no-array-decay`
>  vs `cppcoreguidelines-pro-bounds-array-to-pointer-decay` and so on)
>  each of the aliases must be explicitly be disabled too.

It seems to be the least confusing of possible options. Gabor made a good point why this is useful as it is.

> This is rather inconvenient.
> If that is intentional, perhaps there could be a config option to either disable
>  creation/registration of the check aliases altogether, or an option to threat
>  aliases as a hard link, so anything happening to any of the aliases/base check
>  would happen to all of them.
> (Also, if the check has parameters, and one specifies different parameters for the base check, and the aliases, what happens?)


More information about the cfe-commits mailing list