-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Holly Gong <[email protected]>
- Loading branch information
Showing
4 changed files
with
25 additions
and
25 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package checks | ||
|
||
import ( | ||
"github.com/tidwall/gjson" | ||
) | ||
|
||
var CheckRecordHasAffected = &CheckDef{ | ||
Code: "A0001", | ||
Name: "affected-data-exists", | ||
Description: "every record has affected data", | ||
Check: RecordHasAffected, | ||
} | ||
|
||
// RecordHasAffected checks if the 'affected' field exists in the JSON and is not an empty array. | ||
func RecordHasAffected(json *gjson.Result, config *Config) (findings []CheckError) { | ||
affectedEntries := json.Get("affected") | ||
if !affectedEntries.Exists() || affectedEntries.String() == "[]" { | ||
findings = append(findings, CheckError{Message: "Invalid Affected: affected filed cannot be null or empty"}) | ||
} | ||
return findings | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters