Skip to content
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

Sarif results with empty rules now represents as [] instead of null/nil #786

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion report/sarif.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,24 @@ func getRuns(cfg config.Config, findings []Finding) []Runs {
}

func getTool(cfg config.Config) Tool {
return Tool{
tool := Tool{
Driver: Driver{
Name: driver,
SemanticVersion: version,
Rules: getRules(cfg),
},
}

// if this tool has no rules, ensure that it is represented as [] instead of null/nil
if hasEmptyRules(tool) {
tool.Driver.Rules = make([]Rules, 0)
}

return tool
}

func hasEmptyRules(tool Tool) bool {
return len(tool.Driver.Rules) == 0
}

func getRules(cfg config.Config) []Rules {
Expand Down