Skip to content

Commit 0288930

Browse files
fix: normalize path for exclude-rules
1 parent d0aead4 commit 0288930

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

.golangci.example.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,8 @@ issues:
830830

831831
# Exclude known linters from partially hard-vendored code,
832832
# which is impossible to exclude via "nolint" comments.
833+
# "/" will be replaced by current OS file path separator to properly work
834+
# on Windows.
833835
- path: internal/hmac/
834836
text: "weak cryptographic primitive"
835837
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)