[PATCH] D40671: [clang-tidy] Support specific checks for NOLINT directive

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 14 07:59:54 PST 2017


aaron.ballman added a comment.

In https://reviews.llvm.org/D40671#954906, @xgsa wrote:

> In https://reviews.llvm.org/D40671#954661, @alexfh wrote:
>
> > In https://reviews.llvm.org/D40671#953888, @aaron.ballman wrote:
> >
> > > FWIW, I think we should do something about unknown check names in NOLINT comments, but that can be done as a follow-up patch. If we're ignoring the comment, we might want to diagnose that fact so users have an idea what's going on.
> >
> >
> > IIUC, cpplint can output a diagnostic about unknown categories inside NOLINT and about NOLINT directives that happen on lines where no warning is emitted. Both would be useful in clang-tidy, IMO.
>
>
> I agree with your statements and I think there should be the following diagnostics about NOLINT usage:
>
> - as you described, using of NOLINT with unknown check names;
> - using of NOLINT for the line, on which there is no diagnostics (at all with NOLINT and for the swpecified diagnostics); this should help to detect dangling NOLINT comments, that have no meaning anymore.
>
>   Moreover, there should be a way to turn on/off these diagnostics, so possibily they should be a separate checks. What do you think? Is there a way for a check to collect the emitted diagnostics?


I think this is desirable functionality and can be done in follow-up patches. NOLINT of unknown check names should be pretty easy, but detecting NOLINT comments on lines that do not trigger the specified diagnostic may be a bit more tricky.


https://reviews.llvm.org/D40671





More information about the cfe-commits mailing list