2022-10-29 23:02:42 +05:30
|
|
|
package commentspacings
|
|
|
|
|
|
|
|
//revive:disable:cyclomatic
|
|
|
|
type some struct{}
|
|
|
|
|
|
|
|
//revive:disable:cyclomatic High complexity score but easy to understand
|
|
|
|
type some1 struct{}
|
|
|
|
|
|
|
|
// Some nice comment
|
|
|
|
//
|
|
|
|
// With an empty line in the middle will make the rule panic!
|
|
|
|
func itsATrap() {}
|
|
|
|
|
|
|
|
// This is a well formed comment
|
|
|
|
type hello struct {
|
|
|
|
random `json:random`
|
|
|
|
}
|
|
|
|
|
|
|
|
// MATCH:21 /no space between comment delimiter and comment text/
|
|
|
|
|
|
|
|
//This comment does not respect the spacing rule!
|
|
|
|
var a string
|
|
|
|
|
|
|
|
//myOwnDirective: do something
|
2023-02-17 17:03:11 -03:00
|
|
|
|
|
|
|
/*
|
|
|
|
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
|
|
|
|
*/
|
2023-05-09 10:20:58 -04:00
|
|
|
|
|
|
|
//nolint:staticcheck // nolint should be in the default list of acceptable comments.
|
|
|
|
var b string
|
2024-04-19 16:39:59 +02:00
|
|
|
|
|
|
|
type c struct {
|
|
|
|
//+optional
|
|
|
|
d *int `json:"d,omitempty"`
|
|
|
|
}
|
2024-05-10 12:11:05 +02:00
|
|
|
|
|
|
|
//extern open
|
|
|
|
//export MyFunction
|
|
|
|
|
|
|
|
//nolint:gochecknoglobals
|
2024-05-11 19:19:09 +02:00
|
|
|
|
|
|
|
//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/
|