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:
parent
85333f8533
commit
2d3426f777
@ -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)
|
||||
|
3
testdata/comment-spacings.go
vendored
3
testdata/comment-spacings.go
vendored
@ -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/
|
||||
|
Loading…
x
Reference in New Issue
Block a user