-
Notifications
You must be signed in to change notification settings - Fork 107
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
Fix issues with parsing and SARIF generation for SpaceROS #419
base: spaceros
Are you sure you want to change the base?
Conversation
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.
Initial review is positive! A few comments and observations.
It seems like I made a poor assumption with some of the output, but I'm not sure how to resolve it. Most
These are matched and groups are extracted properly with the regex as it stands. However, some output looks like this:
Here, the rule ID is missing from the result. In most cases, these are preceded by the same exact error, like this block:
In these cases, it's safe to throw away the second result since it is duplicating one already listed (note that both results are pointing to |
It doesn't look like clang-tidy itself supports formatting its output nor does its list of checks state what level a check is is (note, warning, or error). The ruleID is optional right? Can we just omit it for notes? |
According to The Spec, it looks like we can omit
|
Signed-off-by: Eli Benevedes <[email protected]> Signed-off-by: Eli Benevedes <[email protected]>
Signed-off-by: Eli Benevedes <[email protected]> Signed-off-by: Eli Benevedes <[email protected]>
Co-authored-by: Steven! Ragnarök <[email protected]> Signed-off-by: Eli Benevedes <[email protected]>
Signed-off-by: Eli Benevedes <[email protected]> Signed-off-by: Eli Benevedes <[email protected]>
aabbfdb
to
5d5e2ed
Compare
Resolved all outstanding comments in 5d5e2ed. However, a new slight issue arises... I've updated the regex rules to capture all clang_tidy results, even one that don't end in a Is it okay to reduce the tuple to |
Perhaps it would be more accurate to keep the (ruleId, artifact, region) and only make the reduction to (artifact, region) if necessary. In other words, ruleId would be optional in the comparison function, but used if present in both items to be compared. |
I'm following up on this (we have a PR in Space ROS that depends on this). Does it still make sense to do this? If so, what's missing? |
clang-tidy can be configured to output a YAML-formatted "fixes file" which is probably the way I'd recommend to ingest tidy output programmatically. |
rules
field in the SARIF output was polluted with many duplicate rules, as the full error message was included. Now, only the rule id thatclang-tidy
outputs between brackets (i.e.[google-explicit-constructor]
) is taken and stored in rules.startLine
andstartColumn
fields were strings. These are now integers.This was tested on
rclcpp
andrcutils
.ament_clang_tidy
ran successfully on both, and outputted valid SARIF. However, I did have to change some of the RegEx's that were parsingclang_tidy
output. I don't have a great way to check if I'm truly capturing all of the valid output ofclang_tidy
, so this may be unintentionally hiding some violations.