Standardize/alphabetize rules, add cmd/generate/config package (#840)

This commit is contained in:
Zachary Rice authored and GitHub committed 2022-04-12 21:40:48 -05:00
1 parent e784980515
commit 606bb1a13b
62 files changed
+2959 -642

No files matched your search

+2 -3
View File
@@ -374,10 +374,9 @@ func (d *Detector) DetectFiles(source string) ([]report.Finding, error) {
// Detect scans the given fragment and returns a list of findings
func (d *Detector) Detect(fragment Fragment) []report.Finding {
var findings []report.Finding
// check if filepath is allowed
if d.Config.Allowlist.PathAllowed(fragment.FilePath) ||
fragment.FilePath == d.Config.Path {
if fragment.FilePath != "" && (d.Config.Allowlist.PathAllowed(fragment.FilePath) ||
fragment.FilePath == d.Config.Path) {
return findings
}