[PATCH] D30567: [clang-tidy] Fix treating non-space whitespaces in checks list.

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 22 03:38:02 PDT 2017


alexfh added a comment.

In https://reviews.llvm.org/D30567#696436, @curdeius wrote:

> Hi Alex and sorry for the late reply.
>
> The main use case is a more readable `.clang-tidy` configuration checks.
>  Before this correction one can use something like this:
>
>   ---
>   Checks: '
>       ,*,
>       ,-cert-dcl03-c,
>   '
>   ...
>
>
> It works, but is hardly comprehensible to a newbie (the strange use of addtional commas).
>  Since the spaces are ignored (since a recent commit of yours) we can add spaces after the leading comma and hope that no user uses a tab...
>
> After applying this patch, we can just write (with tabs or spaces and as many newlines as we want - used for grouping for instance):
>
>   ---
>   Checks: '
>       *,
>       -cert-dcl03-c,
>   '
>   ...
>
>
> Additionaly, you can sometimes accidentally issue a tabulator on the command line and that's just nice to ignore it.


Currently, one can use YAML folded strings to split the list of checks to multiple lines:

  Checks: >
    -*,
    cert-dcl03-c

So it's not necessary to trim newlines. And tabs are forbidden in YAML: http://www.yaml.org/faq.html. So I'd suggest to leave `.trim(' ')`. The rest of the change looks good - thanks for catching the bug ;)


https://reviews.llvm.org/D30567





More information about the cfe-commits mailing list