[clang-tidy][RFC] Proposal: enable globbing in NOLINT expressions

Hi,

Currently it’s annoying or sometimes impossible (due to line length limit) to accurately inline-suppress clang-tidy warnings. For example:

// NOLINT(cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes)

This is not an uncommon case of someone enabling both a “coding guideline” module and “best practices” module.

The solution turns into a very bad practice, which is disabling all warnings, potentially hiding additional bugs:

// NOLINT

Proposal: support globbing for NOLINT expressions, with the same format/semantics as when enabling/disabling checks:

// NOLINT(*-non-private-member-variables-in-classes)

What do you think?

/Carlos

Hi,

Currently it's annoying or sometimes impossible (due to line length limit) to accurately inline-suppress clang-tidy warnings. For example:

// NOLINT(cppcoreguidelines-non-private-member-variables-in-classes,misc-non-private-member-variables-in-classes)

This is not an uncommon case of someone enabling both a "coding guideline" module and "best practices" module.

The solution turns into a very bad practice, which is disabling all warnings, potentially hiding additional bugs:

// NOLINT

Proposal: support globbing for NOLINT expressions, with the same format/semantics as when enabling/disabling checks:

// NOLINT(*-non-private-member-variables-in-classes)

What do you think?

I think it's a good idea -- we already support some of the globbing
functionality today (https://godbolt.org/z/jTsahYnbM), so this
proposes to extend it in a useful way.

~Aaron

Awesome, thanks! I’ll give it a try when I find some time :slight_smile:

/Carlos

Here’s a patch implementing the functionality, please review!

https://reviews.llvm.org/D111208

Thanks :slight_smile: