Repository navigation
Add rules to SARIF exporter - #6502
Conversation
Generated by 🚫 Danger |
SimplyDanny
left a comment
There was a problem hiding this comment.
Thanks for the fix! There is a more exhaustive way to get all effective rules though ...
|
The test is failing because of the generated new rule "Foo Bar Baz" identified by 'foo_bar'. It doesn't exist in the canned output. What do you suggest @SimplyDanny ? |
Independent of that, I don't like that all rules are now listed in the reference file. They could be omitted and the |
|
Sounds good. I would suggest we test and validate that the rules are created with a valid structure before we remove them. If we just remove the rules array without checking it, we wouldn't be verifying that:
I will update this PR shortly |
|
@SimplyDanny all passed except this Not sure what it means |
Danger doesn't like merge commits. Please rebase your branch instead. |
Co-authored-by: Danny Mösch <[email protected]>
- Access RuleList.list.values instead of mapping RuleList directly - Sort rules by identifier for consistent output ordering - Update reference file to include all 250 rules (248 built-in + 2 core rules)
Validate rules array structure and remove it before comparison to keep the reference file small.
Head branch was pushed to by a user without write access
|
Done, all passed 🎉 |
Co-authored-by: Danny Mösch <[email protected]>
Co-authored-by: Danny Mösch <[email protected]>
Summary
This PR enhances the SARIF reporter to include comprehensive rule metadata in the
tool.driver.rulesarray, making the output fully compliant with the SARIF 2.1.0 specification.Fixes #6499
Changes
rulesarray to SARIF output: Thetool.driver.rulesarray now includes metadata for all 248 built-in SwiftLint rulesid: Rule identifier (e.g.,line_length)shortDescription: Human-readable rule namefullDescription: Detailed rule descriptionhelpUri: Direct link to rule documentation athttps://realm.github.io/SwiftLint/{rule_id}.html.jsonto.sarifextension to follow SARIF naming conventionsBenefits
helpUriExample Output
{ "tool": { "driver": { "name": "SwiftLint", "semanticVersion": "0.63.2", "informationUri": "https://github.com/realm/SwiftLint/blob/0.63.2/README.md", "rules": [ { "id": "line_length", "shortDescription": { "text": "Line Length" }, "fullDescription": { "text": "Lines should not span too many characters." }, "helpUri": "https://realm.github.io/SwiftLint/line_length.html" }, ... ] } }, "results": [...] }Testing