Skip to content

Commit

Permalink
Normalize exclude-rules paths for Windows (golangci#2387)
Browse files Browse the repository at this point in the history
  • Loading branch information
arjenvanderende authored and SeigeC committed Apr 4, 2023
1 parent 777ff7d commit 58c3c8a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .golangci.reference.yml
Expand Up @@ -2158,6 +2158,7 @@ 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 58c3c8a

Please sign in to comment.