diff --git a/testdata/disable_annotations2.go b/testdata/disable_annotations2.go index d82a78f..bd8adad 100644 --- a/testdata/disable_annotations2.go +++ b/testdata/disable_annotations2.go @@ -12,7 +12,6 @@ func foo11() { var invalid_name2 = 1 //revive:disable-line:var-naming I'm an Eiffel programmer thus I like underscores } - func foo2() { // revive:disable-next-line:var-naming //revive:disable diff --git a/testdata/disable_annotations3.go b/testdata/disable_annotations3.go index 95f239c..c8221e7 100644 --- a/testdata/disable_annotations3.go +++ b/testdata/disable_annotations3.go @@ -1,5 +1,6 @@ // Package fix_tures is a testing package // tests for issue #540 +// //revive:disable-next-line:var-naming package fix_tures diff --git a/testdata/duplicated_imports.go b/testdata/duplicated_imports.go index f499b21..9aeef25 100644 --- a/testdata/duplicated_imports.go +++ b/testdata/duplicated_imports.go @@ -1,8 +1,8 @@ package fixtures -import( +import ( "crypto/md5" - "strings" - _ "crypto/md5" // MATCH /Package "crypto/md5" already imported/ - str "strings" // MATCH /Package "strings" already imported/ + _ "crypto/md5" // MATCH /Package "crypto/md5" already imported/ + "strings" + str "strings" // MATCH /Package "strings" already imported/ ) diff --git a/testdata/exported_issue_1002.go b/testdata/exported_issue_1002.go index 8c18b11..fda37f9 100644 --- a/testdata/exported_issue_1002.go +++ b/testdata/exported_issue_1002.go @@ -10,15 +10,15 @@ type Some interface { // Correct - should do all correct Correct() // MATCH /comment on exported interface method Some.SemiCorrect should be of the form "SemiCorrect ..."/ - SemiCorrect() + SemiCorrect() NonCorrect() // MATCH /public interface method Some.NonCorrect should be commented/ } // Other - just to check names compatibility -type Other interface {} +type Other interface{} // for private interfaces it doesn't check docs anyway type somePrivate interface { AllGood() -} \ No newline at end of file +} diff --git a/testdata/exported_issue_1045.go b/testdata/exported_issue_1045.go index a1a1683..22e7773 100644 --- a/testdata/exported_issue_1045.go +++ b/testdata/exported_issue_1045.go @@ -1,15 +1,12 @@ // Package golint comment package golint - // path separator defined by os.Separator. const FilePath = "xyz" - // Rewrite string to remove non-standard path characters func UnicodeSanitize(s string) string {} - // Tags returns a slice of tags. The order is the original tag order unless it // was changed. func (t *Tags) Keys() []string {} @@ -21,7 +18,7 @@ type ItimerWhich int var ToolchainRE = "toolchain" /* -// PropertyBag +// PropertyBag */ // Rectangle An area within an image. -type Rectangle struct {} +type Rectangle struct{} diff --git a/testdata/exported_issue_519.go b/testdata/exported_issue_519.go index aa29a7e..1b2aa2b 100644 --- a/testdata/exported_issue_519.go +++ b/testdata/exported_issue_519.go @@ -3,5 +3,5 @@ package golint // Test case for the configuration option tp replace the word "stutters" by "repetitive" failure messages -// GolintRepetitive is a dummy function +// GolintRepetitive is a dummy function func GolintRepetitive() {} // MATCH /func name will be used as golint.GolintRepetitive by other packages, and that is repetitive; consider calling this Repetitive/ diff --git a/testdata/exported_issue_555.go b/testdata/exported_issue_555.go index 3f64eef..f5b4702 100644 --- a/testdata/exported_issue_555.go +++ b/testdata/exported_issue_555.go @@ -3,5 +3,5 @@ package golint // Test case for disabling stuttering check in exported rule -// GolintSomething is a dummy function +// GolintSomething is a dummy function func GolintSomething() {} diff --git a/testdata/function_length_default.go b/testdata/function_length_default.go index 2b5663e..6883f0e 100644 --- a/testdata/function_length_default.go +++ b/testdata/function_length_default.go @@ -131,4 +131,4 @@ func funLengthB(file *ast.File, fset *token.FileSet, lineLimit, stmtLimit int) [ } } return -} \ No newline at end of file +} diff --git a/testdata/golint/blank_import_with_embed.go b/testdata/golint/blank_import_with_embed.go index 3a52ab4..9557961 100644 --- a/testdata/golint/blank_import_with_embed.go +++ b/testdata/golint/blank_import_with_embed.go @@ -6,9 +6,7 @@ package foo import ( _ "embed" _ "fmt" - /* MATCH:8 /a blank import should be only in a main or test package, or have a comment justifying it/ */ -) + /* MATCH:8 /a blank import should be only in a main or test package, or have a comment justifying it/ */) //go:embed .gitignore var _ string - diff --git a/testdata/golint/exported.go b/testdata/golint/exported.go index 022d422..0c38b25 100644 --- a/testdata/golint/exported.go +++ b/testdata/golint/exported.go @@ -3,7 +3,7 @@ package golint import "net/http" -// GolintFoo is a dummy function +// GolintFoo is a dummy function func GolintFoo() {} // MATCH /func name will be used as golint.GolintFoo by other packages, and that stutters; consider calling this Foo/ type ( @@ -33,12 +33,11 @@ const FirstLetter = "A" /*Bar2 something */ type Bar2 struct{} +/* Bar3 */ // MATCH /comment on exported type Bar3 should be of the form "Bar3 ..." (with optional leading article)/ +type Bar3 struct{} -/* Bar3 */ // MATCH /comment on exported type Bar3 should be of the form "Bar3 ..." (with optional leading article)/ -type Bar3 struct{} - -/* BarXXX invalid */ // MATCH /comment on exported type Bar4 should be of the form "Bar4 ..." (with optional leading article)/ -type Bar4 struct{} +/* BarXXX invalid */ // MATCH /comment on exported type Bar4 should be of the form "Bar4 ..." (with optional leading article)/ +type Bar4 struct{} /*Toto2 something */ func Toto2() {} @@ -47,7 +46,7 @@ func Toto2() {} const SecondLetter = "B" // Tests for common method names -//// Should NOT fail for methods +// Should NOT fail for methods func (_) Error() string { return "" } func (_) String() string { return "" } func (_) ServeHTTP(w http.ResponseWriter, r *http.Request) {} @@ -55,7 +54,7 @@ func (_) Read(p []byte) (n int, err error) { return 0, nil } func (_) Write(p []byte) (n int, err error) { return 0, nil } func (_) Unwrap(err error) error { return nil } -//// Should fail for functions +// Should fail for functions func Error() string { return "" } // MATCH /exported function Error should have comment or be unexported/ func String() string { return "" } // MATCH /exported function String should have comment or be unexported/ diff --git a/testdata/golint/unexported_return.go b/testdata/golint/unexported_return.go index 8a711ac..226e5d3 100644 --- a/testdata/golint/unexported_return.go +++ b/testdata/golint/unexported_return.go @@ -12,15 +12,15 @@ func Exported() hidden { // MATCH /exported func Exported returns unexported typ // ExpErr returns a builtin type. func ExpErr() error { // ok - return nil + return nil } func (h hidden) ExpOnHidden() hidden { // ok - return h + return h } func (hidden) ForInterface() error { - return nil + return nil } // Interface is exported. diff --git a/testdata/import_alias_naming.go b/testdata/import_alias_naming.go index c475f01..e9bb5a7 100644 --- a/testdata/import_alias_naming.go +++ b/testdata/import_alias_naming.go @@ -1,12 +1,12 @@ package fixtures import ( - _ "strings" // _ aliases should be ignored . "dotimport" // . aliases should be ignored + magical "magic/hat" + _ "strings" // _ aliases should be ignored bar_foo "strings" // MATCH /import name (bar_foo) must match the regular expression: ^[a-z][a-z0-9]{0,}$/ fooBAR "strings" // MATCH /import name (fooBAR) must match the regular expression: ^[a-z][a-z0-9]{0,}$/ v1 "strings" - magical "magic/hat" ) func somefunc() { diff --git a/testdata/import_alias_naming_custom_config.go b/testdata/import_alias_naming_custom_config.go index 7fc4d55..c27c866 100644 --- a/testdata/import_alias_naming_custom_config.go +++ b/testdata/import_alias_naming_custom_config.go @@ -1,11 +1,11 @@ package fixtures import ( + magical "magic/hat" _ "strings" bar_foo "strings" // MATCH /import name (bar_foo) must match the regular expression: ^[a-z]+$/ fooBAR "strings" // MATCH /import name (fooBAR) must match the regular expression: ^[a-z]+$/ v1 "strings" // MATCH /import name (v1) must match the regular expression: ^[a-z]+$/ - magical "magic/hat" ) func somefunc() { diff --git a/testdata/import_alias_naming_custom_config_with_multiple_values.go b/testdata/import_alias_naming_custom_config_with_multiple_values.go index cbfb20b..d78e0a6 100644 --- a/testdata/import_alias_naming_custom_config_with_multiple_values.go +++ b/testdata/import_alias_naming_custom_config_with_multiple_values.go @@ -1,12 +1,12 @@ package fixtures import ( + magical "magic/hat" _ "strings" bar_foo "strings" // MATCH /import name (bar_foo) must match the regular expression: ^[a-z][a-z0-9]*$/ fooBAR "strings" // MATCH /import name (fooBAR) must match the regular expression: ^[a-z][a-z0-9]*$/ v1 "strings" // MATCH /import name (v1) must NOT match the regular expression: ^((v\d+)|(v\d+alpha\d+))$/ v1alpha1 "strings" // MATCH /import name (v1alpha1) must NOT match the regular expression: ^((v\d+)|(v\d+alpha\d+))$/ - magical "magic/hat" ) func somefunc() { diff --git a/testdata/import_alias_naming_custom_config_with_only_deny.go b/testdata/import_alias_naming_custom_config_with_only_deny.go index 771ef55..b20b101 100644 --- a/testdata/import_alias_naming_custom_config_with_only_deny.go +++ b/testdata/import_alias_naming_custom_config_with_only_deny.go @@ -1,12 +1,12 @@ package fixtures import ( + magical "magic/hat" _ "strings" bar_foo "strings" fooBAR "strings" v1 "strings" // MATCH /import name (v1) must NOT match the regular expression: ^((v\d+)|(v\d+alpha\d+))$/ v1alpha1 "strings" // MATCH /import name (v1alpha1) must NOT match the regular expression: ^((v\d+)|(v\d+alpha\d+))$/ - magical "magic/hat" ) func somefunc() { diff --git a/testdata/import_shadowing.go b/testdata/import_shadowing.go index 230f807..f5dc391 100644 --- a/testdata/import_shadowing.go +++ b/testdata/import_shadowing.go @@ -1,14 +1,14 @@ package fixtures import ( - ast "go/ast" "bytes" - "crypto/md5" + "crypto/md5" + "fixtures" // Test case for issue #534 "fmt" + ast "go/ast" _ "net/http" "strings" str "strings" - "fixtures" // Test case for issue #534 ) const str = "" // MATCH /The name 'str' shadows an import name/ @@ -17,9 +17,9 @@ type myAst struct { ast *ast.GenDecl } -type bytes struct {} // MATCH /The name 'bytes' shadows an import name/ +type bytes struct{} // MATCH /The name 'bytes' shadows an import name/ -type fmt interface {} // MATCH /The name 'fmt' shadows an import name/ +type fmt interface{} // MATCH /The name 'fmt' shadows an import name/ func (ast myAst) foo() {} // MATCH /The name 'ast' shadows an import name/ @@ -40,6 +40,6 @@ func toto() { } func titi() { - v := md5+bytes + v := md5 + bytes return ast } diff --git a/testdata/imports_blocklist.go b/testdata/imports_blocklist.go index baee90b..7fda745 100644 --- a/testdata/imports_blocklist.go +++ b/testdata/imports_blocklist.go @@ -1,19 +1,19 @@ package fixtures import ( - "github.com/full/match" // MATCH /should not use the following blocklisted import: "github.com/full/match"/ "bithub.com/full/match" + "full" // MATCH /should not use the following blocklisted import: "full"/ + "github.com/full/match" // MATCH /should not use the following blocklisted import: "github.com/full/match"/ "github.com/full/matche" - "wildcard/between" // MATCH /should not use the following blocklisted import: "wildcard/between"/ - "wildcard/pkg1/between" // MATCH /should not use the following blocklisted import: "wildcard/pkg1/between"/ - "wildcard/pkg1/pkg2/between" // MATCH /should not use the following blocklisted import: "wildcard/pkg1/pkg2/between"/ - "wildcard/backward" // MATCH /should not use the following blocklisted import: "wildcard/backward"/ - "wildcard/backward/pkg" // MATCH /should not use the following blocklisted import: "wildcard/backward/pkg"/ - "wildcard/backward/pkg/pkg1" // MATCH /should not use the following blocklisted import: "wildcard/backward/pkg/pkg1"/ - "wildcard/forward" // MATCH /should not use the following blocklisted import: "wildcard/forward"/ - "pkg/wildcard/forward" // MATCH /should not use the following blocklisted import: "pkg/wildcard/forward"/ - "pkg/pkg1/wildcard/forward" // MATCH /should not use the following blocklisted import: "pkg/pkg1/wildcard/forward"/ - "full" // MATCH /should not use the following blocklisted import: "full"/ "github.com/partical/match/fully" + "pkg/pkg1/wildcard/forward" // MATCH /should not use the following blocklisted import: "pkg/pkg1/wildcard/forward"/ + "pkg/wildcard/forward" // MATCH /should not use the following blocklisted import: "pkg/wildcard/forward"/ "strings" + "wildcard/backward" // MATCH /should not use the following blocklisted import: "wildcard/backward"/ + "wildcard/backward/pkg" // MATCH /should not use the following blocklisted import: "wildcard/backward/pkg"/ + "wildcard/backward/pkg/pkg1" // MATCH /should not use the following blocklisted import: "wildcard/backward/pkg/pkg1"/ + "wildcard/between" // MATCH /should not use the following blocklisted import: "wildcard/between"/ + "wildcard/forward" // MATCH /should not use the following blocklisted import: "wildcard/forward"/ + "wildcard/pkg1/between" // MATCH /should not use the following blocklisted import: "wildcard/pkg1/between"/ + "wildcard/pkg1/pkg2/between" // MATCH /should not use the following blocklisted import: "wildcard/pkg1/pkg2/between"/ ) diff --git a/testdata/imports_blocklist_original.go b/testdata/imports_blocklist_original.go index d5244e8..34fb7e6 100644 --- a/testdata/imports_blocklist_original.go +++ b/testdata/imports_blocklist_original.go @@ -5,4 +5,3 @@ import ( "crypto/sha1" // MATCH /should not use the following blocklisted import: "crypto/sha1"/ "strings" ) - diff --git a/testdata/redundant_import_alias.go b/testdata/redundant_import_alias.go index 555bca2..c5fe90e 100644 --- a/testdata/redundant_import_alias.go +++ b/testdata/redundant_import_alias.go @@ -1,12 +1,11 @@ package fixtures -import( +import ( "crypto/md5" - "strings" - _ "crypto/md5" - str "strings" - strings "strings" // MATCH /Import alias "strings" is redundant/ - crypto "crypto/md5" - md5 "crypto/md5" // MATCH /Import alias "md5" is redundant/ + _ "crypto/md5" + crypto "crypto/md5" + md5 "crypto/md5" // MATCH /Import alias "md5" is redundant/ + "strings" + str "strings" + strings "strings" // MATCH /Import alias "strings" is redundant/ ) - diff --git a/testdata/useless_break.go b/testdata/useless_break.go index f8b5261..3e729cc 100644 --- a/testdata/useless_break.go +++ b/testdata/useless_break.go @@ -95,7 +95,7 @@ func UselessBreaks() { break // MATCH /useless break in case clause/ case 2: fmt.Println("bar") - break + break fmt.Println("baz") case 3: }