File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -243,13 +243,20 @@ func FilterRulesFromSarif(sarifData []byte) ([]byte, error) {
243243 if runMap , ok := run .(map [string ]interface {}); ok {
244244 if tool , ok := runMap ["tool" ].(map [string ]interface {}); ok {
245245 if driver , ok := tool ["driver" ].(map [string ]interface {}); ok {
246- driver ["rules" ] = nil
246+ if _ , exists := driver ["rules" ]; exists {
247+ driver ["rules" ] = nil
248+ }
247249 }
248250 }
249251 }
250252 }
251253 }
252254
253255 // Marshal back to JSON with indentation
254- 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
255262}
You can’t perform that action at this time.
0 commit comments