Bug in .clang-tidy parsing?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Bug in .clang-tidy parsing?

Sumner, Brian via cfe-dev
Hi all,

Not sure if this is a bug or i'm just misunderstanding how configuration for .clang-tidy is supposed to work.

In my .clang-tidy I have specified the checks to be run as follows:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    cppcoreguidelines-pro-*,
    -cppcoreguidelines-pro-bounds-pointer-arithmetic,
    misc-*, 
    modernize-*,
    performance-*,

What I expect when I run clang-tidy is that it will run all the checks except for cppcoreguidelines-pro-bounds-pointer-arithmetic and the llvm and readability checks. Instead, clang-tidy seems to run every check. If I change the list to just be something like this:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 

Then the expected behavior occurs, only the cert and clang-analyzer checks are run. But if I add anything more, for example:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    modernize-*,

Then again, all checks are run, not just cert, clang-analyzer and modernize. Is this expected behavior?

-Paul Wicks

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug in .clang-tidy parsing?

Sumner, Brian via cfe-dev
+alex 

On Tue, Aug 8, 2017 at 7:45 PM Paul Wicks via cfe-dev <[hidden email]> wrote:
Hi all,

Not sure if this is a bug or i'm just misunderstanding how configuration for .clang-tidy is supposed to work.

In my .clang-tidy I have specified the checks to be run as follows:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    cppcoreguidelines-pro-*,
    -cppcoreguidelines-pro-bounds-pointer-arithmetic,
    misc-*, 
    modernize-*,
    performance-*,

What I expect when I run clang-tidy is that it will run all the checks except for cppcoreguidelines-pro-bounds-pointer-arithmetic and the llvm and readability checks. Instead, clang-tidy seems to run every check. If I change the list to just be something like this:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 

Then the expected behavior occurs, only the cert and clang-analyzer checks are run. But if I add anything more, for example:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    modernize-*,

Then again, all checks are run, not just cert, clang-analyzer and modernize. Is this expected behavior?

-Paul Wicks
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug in .clang-tidy parsing?

Sumner, Brian via cfe-dev
The issue seems to be that the LLVM's YAML parser doesn't implement multiline literal folding, which results in the checks list containing line breaks. Clang-tidy doesn't drop newlines in the checks list (because I haven't recognized the limitation of our YAML parser when reviewing https://reviews.llvm.org/D30567), and the list of checks is misinterpreted.

There are (at least) two solutions:
1. Ideally, YAML parser would benefit from the support of multiline literal folding.
2. As a quick workaround, we can trim newlines from the checks list.

On Wed, Aug 9, 2017 at 2:41 PM, Manuel Klimek <[hidden email]> wrote:
+alex 

On Tue, Aug 8, 2017 at 7:45 PM Paul Wicks via cfe-dev <[hidden email]> wrote:
Hi all,

Not sure if this is a bug or i'm just misunderstanding how configuration for .clang-tidy is supposed to work.

In my .clang-tidy I have specified the checks to be run as follows:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    cppcoreguidelines-pro-*,
    -cppcoreguidelines-pro-bounds-pointer-arithmetic,
    misc-*, 
    modernize-*,
    performance-*,

What I expect when I run clang-tidy is that it will run all the checks except for cppcoreguidelines-pro-bounds-pointer-arithmetic and the llvm and readability checks. Instead, clang-tidy seems to run every check. If I change the list to just be something like this:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 

Then the expected behavior occurs, only the cert and clang-analyzer checks are run. But if I add anything more, for example:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    modernize-*,

Then again, all checks are run, not just cert, clang-analyzer and modernize. Is this expected behavior?

-Paul Wicks
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug in .clang-tidy parsing?

Sumner, Brian via cfe-dev
I've committed a workaround (2) in r310491.

On Wed, Aug 9, 2017 at 5:28 PM, Alexander Kornienko <[hidden email]> wrote:
The issue seems to be that the LLVM's YAML parser doesn't implement multiline literal folding, which results in the checks list containing line breaks. Clang-tidy doesn't drop newlines in the checks list (because I haven't recognized the limitation of our YAML parser when reviewing https://reviews.llvm.org/D30567), and the list of checks is misinterpreted.

There are (at least) two solutions:
1. Ideally, YAML parser would benefit from the support of multiline literal folding.
2. As a quick workaround, we can trim newlines from the checks list.

On Wed, Aug 9, 2017 at 2:41 PM, Manuel Klimek <[hidden email]> wrote:
+alex 

On Tue, Aug 8, 2017 at 7:45 PM Paul Wicks via cfe-dev <[hidden email]> wrote:
Hi all,

Not sure if this is a bug or i'm just misunderstanding how configuration for .clang-tidy is supposed to work.

In my .clang-tidy I have specified the checks to be run as follows:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    cppcoreguidelines-pro-*,
    -cppcoreguidelines-pro-bounds-pointer-arithmetic,
    misc-*, 
    modernize-*,
    performance-*,

What I expect when I run clang-tidy is that it will run all the checks except for cppcoreguidelines-pro-bounds-pointer-arithmetic and the llvm and readability checks. Instead, clang-tidy seems to run every check. If I change the list to just be something like this:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 

Then the expected behavior occurs, only the cert and clang-analyzer checks are run. But if I add anything more, for example:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    modernize-*,

Then again, all checks are run, not just cert, clang-analyzer and modernize. Is this expected behavior?

-Paul Wicks
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Bug in .clang-tidy parsing?

Sumner, Brian via cfe-dev
Thanks for the quick turnaround! I also discovered that if I list every single check explicitly and don't use any wildcards apart from the first "-*", then only the listed checks are used and everything seems to work, e.g.:

Checks: > 
    -*,
    cert-dcl03-c,
    cert-dcl50-cpp,
    cert-dcl54-cpp,
    cert-dcl59-cpp,
    cert-err52-cpp,
    cert-err58-cpp,
    cert-err60-cpp,
    ....
    many many more checks

-Paul Wicks

On Wed, Aug 9, 2017 at 9:02 AM, Alexander Kornienko <[hidden email]> wrote:
I've committed a workaround (2) in r310491.

On Wed, Aug 9, 2017 at 5:28 PM, Alexander Kornienko <[hidden email]> wrote:
The issue seems to be that the LLVM's YAML parser doesn't implement multiline literal folding, which results in the checks list containing line breaks. Clang-tidy doesn't drop newlines in the checks list (because I haven't recognized the limitation of our YAML parser when reviewing https://reviews.llvm.org/D30567), and the list of checks is misinterpreted.

There are (at least) two solutions:
1. Ideally, YAML parser would benefit from the support of multiline literal folding.
2. As a quick workaround, we can trim newlines from the checks list.

On Wed, Aug 9, 2017 at 2:41 PM, Manuel Klimek <[hidden email]> wrote:
+alex 

On Tue, Aug 8, 2017 at 7:45 PM Paul Wicks via cfe-dev <[hidden email]> wrote:
Hi all,

Not sure if this is a bug or i'm just misunderstanding how configuration for .clang-tidy is supposed to work.

In my .clang-tidy I have specified the checks to be run as follows:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    cppcoreguidelines-pro-*,
    -cppcoreguidelines-pro-bounds-pointer-arithmetic,
    misc-*, 
    modernize-*,
    performance-*,

What I expect when I run clang-tidy is that it will run all the checks except for cppcoreguidelines-pro-bounds-pointer-arithmetic and the llvm and readability checks. Instead, clang-tidy seems to run every check. If I change the list to just be something like this:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 

Then the expected behavior occurs, only the cert and clang-analyzer checks are run. But if I add anything more, for example:

Checks: > 
    -*,
    cert-*,
    clang-analyzer-*, 
    modernize-*,

Then again, all checks are run, not just cert, clang-analyzer and modernize. Is this expected behavior?

-Paul Wicks
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Loading...