Skip to content

Commit

Permalink
checker/whyNoLint: compile regex when it is needed (#1182)
Browse files Browse the repository at this point in the history
  • Loading branch information
cristaloleg committed Dec 31, 2021
1 parent 423f103 commit a901015
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions checkers/whyNoLint_checker.go
Expand Up @@ -17,12 +17,11 @@ func init() {
Before: `//nolint`,
After: `//nolint // reason`,
}
re := regexp.MustCompile(`^// *nolint(?::[^ ]+)? *(.*)$`)

collection.AddChecker(&info, func(ctx *linter.CheckerContext) (linter.FileWalker, error) {
return astwalk.WalkerForComment(&whyNoLintChecker{
ctx: ctx,
re: re,
re: regexp.MustCompile(`^// *nolint(?::[^ ]+)? *(.*)$`),
}), nil
})
}
Expand Down

0 comments on commit a901015

Please sign in to comment.