-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a clang problem matcher #43222
Add a clang problem matcher #43222
Conversation
6a68e6b
to
d506191
Compare
Looks like it's working. You can see an annotation in the diff view here. If all goes well a second annotation should appear once the clang-tidy run finishes. |
OK, looks like the annotation is repeated for every time the header was included. That's mildly annoying, but I guess that's how things are. |
For reference, the issue with duplicate annotations has been discussed here and it doesn't look like there's a simple solution. |
Problem matchers are a feature of GitHub actions intended to make it easier to quickly locate the interesting part of failed CI output. This is a first attempt to write a problem matcher for CDDA. This one is intended to match error messages from clang and clang-tidy (and I think it will work for gcc too).
Clang build analyzer can also produce clang errors but doesn't use the standard build scripts. Enable the problem matcher there right in the workflow yaml.
d506191
to
8134751
Compare
I've marked this ready for review now. If we're content to risk the duplicated annotations then it's safe to merge. I have some ideas of how to reduce duplication spam somewhat if it gets bad, but I won't do them on this PR unless I get more encouragement to. |
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "cata-clang", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(.+):(\\d+):(\\d+):\\s(error|warning):\\s(.+)\\s\\[(.+)\\]$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"severity": 4, | ||
"message": 5, | ||
"code": 6 | ||
} | ||
] | ||
} | ||
] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might find this problem matcher just works:
https://github.com/marketplace/actions/gcc-problem-matcher
Otherwise you might want to publish the problem matcher JSON as an action on its own (like the GCC one) so others can benefit too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm mildly in favour of using the existing action, let's go that way unless you have an objection jbtw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I'll close this and open another PR.
Summary
SUMMARY: Infrastructure "Add a clang problem matcher"
Purpose of change
Partially addresses #39904.
To make it easier for contributors and reviewers to understand problems reported by CI.
Describe the solution
Add a problem matcher and the toolkit command required to activate it.
This first matcher is intended to understand clang and clang-tidy errors. I suspect it might work for gcc too.
Describe alternatives you've considered
Maintaining inscrutability.
Testing
Needs to be tested live, so I'm opening this as a draft PR to that end.
Additional context
Hope to add more for other common failure situations, but this is a start to learn how problem matchers work.