microsoft / sarif-sdk

.NET code and supporting files for working with the 'Static Analysis Results Interchange Format' (SARIF, see https://github.com/oasis-tcs/sarif-spec)
Other
191 stars 88 forks source link

[REQUEST] Allow users of the SARIF SDK to emit SARIF results with both ruleId and rule.id #2721

Closed dotpaul closed 6 months ago

dotpaul commented 10 months ago

The ShouldSerializeRuleId() method in https://github.com/microsoft/sarif-sdk/blob/b8c063659520e72c5bcc96db9f2061378fcb2333/src/Sarif/Core/Result.cs#L20 disallows serializing ruleId when rule.id is present.

For consumers of the SARIF SDK who wish to emit both ruleId and rule.id (I imagine there a few implementations of reading SARIF files only expecting ruleId?), it'd be nice if the ShouldSerializeRuleId() method was virtual. Then a consumer could derive from the Result class and override to always serialize the ruleId property