mirror of
				https://github.com/mgechev/revive.git
				synced 2025-10-30 23:37:49 +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:
		| @@ -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 | ||||
| 			} | ||||
|   | ||||
							
								
								
									
										17
									
								
								testdata/comment-spacings.go
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								testdata/comment-spacings.go
									
									
									
									
										vendored
									
									
								
							| @@ -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 | ||||
|  */ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user