Skip to content

Commit 58c3c8a

Browse files
arjenvanderendeSeigeC
authored andcommitted
Normalize exclude-rules paths for Windows (golangci#2387)
1 parent 777ff7d commit 58c3c8a

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
@@ -2158,6 +2158,7 @@ issues:
21582158

21592159
# Exclude known linters from partially hard-vendored code,
21602160
# which is impossible to exclude via `nolint` comments.
2161+
# `/` will be replaced by current OS file path separator to properly work on Windows.
21612162
- path: internal/hmac/
21622163
text: "weak cryptographic primitive"
21632164
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)