We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3d468b3 commit df2ff76Copy full SHA for df2ff76
1 file changed
utils/sarif.go
@@ -243,13 +243,20 @@ func FilterRulesFromSarif(sarifData []byte) ([]byte, error) {
243
if runMap, ok := run.(map[string]interface{}); ok {
244
if tool, ok := runMap["tool"].(map[string]interface{}); ok {
245
if driver, ok := tool["driver"].(map[string]interface{}); ok {
246
- driver["rules"] = nil
+ if _, exists := driver["rules"]; exists {
247
+ driver["rules"] = nil
248
+ }
249
}
250
251
252
253
254
255
// Marshal back to JSON with indentation
- return json.MarshalIndent(report, "", " ")
256
+ filteredData, err := json.MarshalIndent(report, "", " ")
257
+ if err != nil {
258
+ return nil, fmt.Errorf("failed to marshal filtered SARIF: %w", err)
259
260
+
261
+ return filteredData, nil
262
0 commit comments