1
0
mirror of https://github.com/mgechev/revive.git synced 2025-03-17 20:57:58 +02:00

more precise regular expression for directive comments (#988)

Co-authored-by: chavacava <salvador.cavadini@gmail.com>
This commit is contained in:
chavacava 2024-05-11 19:19:09 +02:00 committed by GitHub
parent 85333f8533
commit 2d3426f777
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -166,7 +166,7 @@ func checkNumberOfArguments(expected int, args lint.Arguments, ruleName string)
}
}
var directiveCommentRE = regexp.MustCompile("//(line |extern |export |[a-z0-9]+:[a-z0-9])") // see https://go-review.googlesource.com/c/website/+/442516/1..2/_content/doc/comment.md#494
var directiveCommentRE = regexp.MustCompile("^//(line |extern |export |[a-z0-9]+:[a-z0-9])") // see https://go-review.googlesource.com/c/website/+/442516/1..2/_content/doc/comment.md#494
func isDirectiveComment(line string) bool {
return directiveCommentRE.MatchString(line)

View File

@ -52,3 +52,6 @@ type c struct {
//export MyFunction
//nolint:gochecknoglobals
//this is a regular command that's incorrectly formatted //nolint:foobar // because one two three
// MATCH:56 /no space between comment delimiter and comment text/