chore: Enable bad regex gocritic linter (#14295)
This commit is contained in:
parent
edf230bc44
commit
5505a2150a
|
|
@ -81,6 +81,7 @@ linters-settings:
|
||||||
- badCall
|
- badCall
|
||||||
- badCond
|
- badCond
|
||||||
- badLock
|
- badLock
|
||||||
|
- badRegexp
|
||||||
- badSorting
|
- badSorting
|
||||||
- builtinShadowDecl
|
- builtinShadowDecl
|
||||||
- caseOrder
|
- caseOrder
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Regular expression to see if a path element contains an origin
|
// Regular expression to see if a path element contains an origin
|
||||||
var originPattern = regexp.MustCompile(`^([\w-_]+):`)
|
var originPattern = regexp.MustCompile(`^([\w-]+):`)
|
||||||
|
|
||||||
type keySegment struct {
|
type keySegment struct {
|
||||||
name string
|
name string
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@ import (
|
||||||
const DefaultTemplate = "host.tags.measurement.field"
|
const DefaultTemplate = "host.tags.measurement.field"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
compatibleAllowedCharsName = regexp.MustCompile(`[^ "-:\<>-\]_a-~\p{L}]`)
|
compatibleAllowedCharsName = regexp.MustCompile(`[^ "-:\<>-\]_a-~\p{L}]`) //nolint: gocritic // valid range for use-case
|
||||||
compatibleAllowedCharsValue = regexp.MustCompile(`[^ -:<-~\p{L}]`)
|
compatibleAllowedCharsValue = regexp.MustCompile(`[^ -:<-~\p{L}]`) //nolint: gocritic // valid range for use-case
|
||||||
compatibleLeadingTildeDrop = regexp.MustCompile(`^[~]*(.*)`)
|
compatibleLeadingTildeDrop = regexp.MustCompile(`^[~]*(.*)`)
|
||||||
hyphenChars = strings.NewReplacer(
|
hyphenChars = strings.NewReplacer(
|
||||||
"/", "-",
|
"/", "-",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue