mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
Sarif results with empty rules now represents as [] instead of null/nil (#786)
This commit is contained in:
1 parent
9261f1c47f
commit
d1f642a9df
1 file changed
+12
-1
+12
-1
@@ -30,13 +30,24 @@ func getRuns(cfg config.Config, findings []Finding) []Runs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getTool(cfg config.Config) Tool {
|
func getTool(cfg config.Config) Tool {
|
||||||
return Tool{
|
tool := Tool{
|
||||||
Driver: Driver{
|
Driver: Driver{
|
||||||
Name: driver,
|
Name: driver,
|
||||||
SemanticVersion: version,
|
SemanticVersion: version,
|
||||||
Rules: getRules(cfg),
|
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 {
|
func getRules(cfg config.Config) []Rules {
|
||||||
|
|||||||
Reference in new issue
Block a user