Skip to content

Commit

Permalink
fix: normalize path for exclude-rules
Browse files Browse the repository at this point in the history
  • Loading branch information
arjenvanderende committed Nov 30, 2021
1 parent d0aead4 commit 0288930
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .golangci.example.yml
Expand Up @@ -830,6 +830,8 @@ issues:

# Exclude known linters from partially hard-vendored code,
# which is impossible to exclude via "nolint" comments.
# "/" will be replaced by current OS file path separator to properly work
# on Windows.
- path: internal/hmac/
text: "weak cryptographic primitive"
linters:
Expand Down
3 changes: 2 additions & 1 deletion pkg/result/processors/exclude_rules.go
Expand Up @@ -44,7 +44,8 @@ func createRules(rules []ExcludeRule, prefix string) []excludeRule {
parsedRule.source = regexp.MustCompile(prefix + rule.Source)
}
if rule.Path != "" {
parsedRule.path = regexp.MustCompile(rule.Path)
path := normalizePathInRegex(rule.Path)
parsedRule.path = regexp.MustCompile(path)
}
parsedRules = append(parsedRules, parsedRule)
}
Expand Down

0 comments on commit 0288930

Please sign in to comment.