1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-06 03:04:06 +02:00

fixing comment spacings (#789)

* fixing comments spacing

* Updating comment spacing test cases

* adds test cases for multiline comments

---------

Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
This commit is contained in:
Felipe David 2023-02-17 17:03:11 -03:00 committed by GitHub
parent 4981346ff9
commit 8c2cd33315
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -47,7 +47,13 @@ func (r *CommentSpacingsRule) Apply(file *lint.File, args lint.Arguments) []lint
continue // nothing to do
}
isOK := commentLine[2] == ' '
isMultiLineComment := commentLine[1] == '*'
isOK := commentLine[2] == '\n'
if isMultiLineComment && isOK {
continue
}
isOK = (commentLine[2] == ' ') || (commentLine[2] == '\t')
if isOK {
continue
}

View File

@ -22,3 +22,20 @@ type hello struct {
var a string
//myOwnDirective: do something
/*
Should be valid
*/
// Tabs between comment delimeter and comment text should be fine
// MATCH:34 /no space between comment delimiter and comment text/
/*Not valid
*/
/* valid
*/
/* valid
*/