-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support ShellCheck SARIF rule metadata #68
Conversation
@jamacku, Can you please check that the version of |
@lzaoral sure, I'll have a look. Thanks |
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.
@jamacku, Could please try it again with the latest changes? Note that this PR is just a proof-of-concept. I'm not really happy with the current implementation. |
@lzaoral It's unfortunate, but it still doesn't show a hint message in GitHub UI. |
@lzaoral I came across this repo with SARIF examples: https://github.com/microsoft/sarif-tutorials It seems like a good source of information if it's not outdated. https://github.com/microsoft/sarif-tutorials/blob/main/docs/2-Basics.md#rule-metadata |
@jamacku, could you try it once again, please? I've added the [1] https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/sarif-v2.1.0-os.html#_Toc34317838 |
@lzaoral It WORKS 🥳 But I'm not sure if it displays a correct message. |
ae7a6ac
to
a59cc00
Compare
@jamacku, Could you try it once more, please? This time with much cleaner and simpler code. Thanks in advance! |
@lzaoral Please see: It works great! 🥳 I'm thinking if it would make sense to say something like:
Or maybe even try to take advantage of supported markdown templating and generate something like: Defect reference: [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) |
a59cc00
to
6a160d8
Compare
@lzaoral Works great 💯 Markdown templating: Defect searching by rule: |
0d4dcdc
to
b432be6
Compare
This PR should be finally ready for a proper review. 🥳 |
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.
It works like a charm! LGTM 👍
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.
Thank you for moving it forward! Could we please extend the SARIF writer such that CWE IDs are preserved when available even for ShellCheck? We have our own mapping of SCNNNN
to CWE-NNN
in csmock: https://github.com/csutils/csmock/blob/0d96eeabbc064f828c35fbea95ebd3616295b8b7/cwe-map.csv#L425 I would like to avoid losing this data when we convert csmock's output to SARIF.
Unfortunately, SARIF allows at most one rule per defect. Will be something like this enough? "properties": {
"cwe": [
"CWE-248"
]
"tags": [
"ShellCheck"
]
} |
SARIF's rule is |
Yes, concatenating the help texts is possible. |
9b7a74d
to
6e21e20
Compare
I've updated the PR with changes addressing concerns raised in #68 (review). |
6e21e20
to
410a3d1
Compare
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.
Thanks for the update! I think it works as expected now.
The implementation could be optimized for future extensions. I would create a structure RuleProps
and a single map from ruleId
to RuleProps
, in order to make adding new properties in the future more straightforward. But this can be refactored later on when we actually need it.
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.
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.
410a3d1
to
2ea18ad
Compare
Thanks for the reviews! |
This is a proof-of-concept at the moment.
Fixes #54.