Skip to content

Commit a02bc55

Browse files
arjenvanderendeldez
authored andcommitted
fix: normalize path for exclude-rules
1 parent 846fab8 commit a02bc55

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

.golangci.reference.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,6 +2080,7 @@ issues:
20802080

20812081
# Exclude known linters from partially hard-vendored code,
20822082
# which is impossible to exclude via `nolint` comments.
2083+
# `/` will be replaced by current OS file path separator to properly work on Windows.
20832084
- path: internal/hmac/
20842085
text: "weak cryptographic primitive"
20852086
linters:

pkg/result/processors/exclude_rules.go

Lines changed: 2 additions & 1 deletion
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)