chore: Enable bad regex gocritic linter (#14295)

This commit is contained in:
Joshua Powers 2023-11-15 12:35:41 -07:00 committed by GitHub
parent edf230bc44
commit 5505a2150a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 3 deletions

View File

@ -81,6 +81,7 @@ linters-settings:
- badCall
- badCond
- badLock
- badRegexp
- badSorting
- builtinShadowDecl
- caseOrder

View File

@ -8,7 +8,7 @@ import (
)
// Regular expression to see if a path element contains an origin
var originPattern = regexp.MustCompile(`^([\w-_]+):`)
var originPattern = regexp.MustCompile(`^([\w-]+):`)
type keySegment struct {
name string

View File

@ -17,8 +17,8 @@ import (
const DefaultTemplate = "host.tags.measurement.field"
var (
compatibleAllowedCharsName = regexp.MustCompile(`[^ "-:\<>-\]_a-~\p{L}]`)
compatibleAllowedCharsValue = regexp.MustCompile(`[^ -:<-~\p{L}]`)
compatibleAllowedCharsName = regexp.MustCompile(`[^ "-:\<>-\]_a-~\p{L}]`) //nolint: gocritic // valid range for use-case
compatibleAllowedCharsValue = regexp.MustCompile(`[^ -:<-~\p{L}]`) //nolint: gocritic // valid range for use-case
compatibleLeadingTildeDrop = regexp.MustCompile(`^[~]*(.*)`)
hyphenChars = strings.NewReplacer(
"/", "-",