mirror of
https://github.com/gitleaks/gitleaks.git
synced 2026-11-30 05:04:22 +01:00
* Add support in .gitleaksignore file comment strings (#1195) * Apply suggestions from code review Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com> --------- Co-authored-by: Zachary Rice <zricezrice@gmail.com> Co-authored-by: Richard Gomez <32133502+rgmz@users.noreply.github.com>
This commit is contained in:
2 files changed
+6
-1
No files matched your search
+5
-1
@@ -149,7 +149,11 @@ func (d *Detector) AddGitleaksIgnore(gitleaksIgnorePath string) error {
|
||||
scanner := bufio.NewScanner(file)
|
||||
|
||||
for scanner.Scan() {
|
||||
d.gitleaksIgnore[scanner.Text()] = true
|
||||
line := strings.TrimSpace(scanner.Text())
|
||||
// Skip lines that start with a comment
|
||||
if line != "" && !strings.HasPrefix(line, "#") {
|
||||
d.gitleaksIgnore[line] = true
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user