mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
refactor: gofmt testdata (#1379)
This commit is contained in:
1
testdata/disable_annotations2.go
vendored
1
testdata/disable_annotations2.go
vendored
@@ -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
|
||||
|
||||
1
testdata/disable_annotations3.go
vendored
1
testdata/disable_annotations3.go
vendored
@@ -1,5 +1,6 @@
|
||||
// Package fix_tures is a testing package
|
||||
// tests for issue #540
|
||||
//
|
||||
//revive:disable-next-line:var-naming
|
||||
package fix_tures
|
||||
|
||||
|
||||
2
testdata/duplicated_imports.go
vendored
2
testdata/duplicated_imports.go
vendored
@@ -2,7 +2,7 @@ package fixtures
|
||||
|
||||
import (
|
||||
"crypto/md5"
|
||||
"strings"
|
||||
_ "crypto/md5" // MATCH /Package "crypto/md5" already imported/
|
||||
"strings"
|
||||
str "strings" // MATCH /Package "strings" already imported/
|
||||
)
|
||||
|
||||
3
testdata/exported_issue_1045.go
vendored
3
testdata/exported_issue_1045.go
vendored
@@ -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 {}
|
||||
|
||||
4
testdata/golint/blank_import_with_embed.go
vendored
4
testdata/golint/blank_import_with_embed.go
vendored
@@ -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
|
||||
|
||||
|
||||
5
testdata/golint/exported.go
vendored
5
testdata/golint/exported.go
vendored
@@ -33,7 +33,6 @@ 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{}
|
||||
|
||||
@@ -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/
|
||||
|
||||
4
testdata/import_alias_naming.go
vendored
4
testdata/import_alias_naming.go
vendored
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
4
testdata/import_shadowing.go
vendored
4
testdata/import_shadowing.go
vendored
@@ -1,14 +1,14 @@
|
||||
package fixtures
|
||||
|
||||
import (
|
||||
ast "go/ast"
|
||||
"bytes"
|
||||
"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/
|
||||
|
||||
18
testdata/imports_blocklist.go
vendored
18
testdata/imports_blocklist.go
vendored
@@ -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"/
|
||||
"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"/
|
||||
"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"
|
||||
"strings"
|
||||
"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"/
|
||||
)
|
||||
|
||||
1
testdata/imports_blocklist_original.go
vendored
1
testdata/imports_blocklist_original.go
vendored
@@ -5,4 +5,3 @@ import (
|
||||
"crypto/sha1" // MATCH /should not use the following blocklisted import: "crypto/sha1"/
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
||||
7
testdata/redundant_import_alias.go
vendored
7
testdata/redundant_import_alias.go
vendored
@@ -2,11 +2,10 @@ package fixtures
|
||||
|
||||
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/
|
||||
"strings"
|
||||
str "strings"
|
||||
strings "strings" // MATCH /Import alias "strings" is redundant/
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user