Skip to content

Commit 7030fa7

Browse files
changed git report message
1 parent 6ace382 commit 7030fa7

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/reporting/sarif.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ func hasNoResults(report Report) bool {
6969
}
7070

7171
func messageText(ruleName string, filePath string) string {
72+
finalPath := filePath
73+
74+
// maintain only the filename if the scan target is git
75+
if strings.HasPrefix(finalPath, "git show ") {
76+
trimmed := strings.TrimPrefix(finalPath, "git show ")
77+
parts := strings.Split(trimmed, ":")
78+
if len(parts) == 2 {
79+
return parts[1]
80+
}
81+
}
82+
7283
return fmt.Sprintf("%s has detected secret for file %s.", ruleName, filePath)
7384
}
7485

0 commit comments

Comments
 (0)