Skip to content

Commit 890a826

Browse files
Normalize exclude-rules paths for Windows (#2387)
1 parent cbe6330 commit 890a826

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.golangci.reference.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2133,6 +2133,7 @@ issues:
21332133

21342134
# Exclude known linters from partially hard-vendored code,
21352135
# which is impossible to exclude via `nolint` comments.
2136+
# `/` will be replaced by current OS file path separator to properly work on Windows.
21362137
- path: internal/hmac/
21372138
text: "weak cryptographic primitive"
21382139
linters:

pkg/result/processors/exclude_rules.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ func createRules(rules []ExcludeRule, prefix string) []excludeRule {
4444
parsedRule.source = regexp.MustCompile(prefix + rule.Source)
4545
}
4646
if rule.Path != "" {
47-
parsedRule.path = regexp.MustCompile(rule.Path)
47+
path := normalizePathInRegex(rule.Path)
48+
parsedRule.path = regexp.MustCompile(path)
4849
}
4950
parsedRules = append(parsedRules, parsedRule)
5051
}

0 commit comments

Comments
 (0)