diff --git a/.golangci.yml b/.golangci.yml index 344d9962..05a73c36 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -21,8 +21,13 @@ linters: - prealloc - predeclared - reassign + - revive - testifylint linters-settings: + revive: + enable-all-rules: false + rules: + - name: 'var-naming' staticcheck: checks: - all @@ -34,3 +39,8 @@ linters-settings: - empty - expected-actual - len +issues: + exclude-rules: + - linters: + - revive + text: "var-naming: don't use an underscore in package name" diff --git a/cmd/mockery_test.go b/cmd/mockery_test.go index 068e06eb..f2acb01a 100644 --- a/cmd/mockery_test.go +++ b/cmd/mockery_test.go @@ -20,28 +20,28 @@ func TestNewRootCmd(t *testing.T) { func Test_initConfig(t *testing.T) { tests := []struct { name string - base_path string + basePath string configPath string }{ { name: "test config at base directory", - base_path: "1/2/3/4", + basePath: "1/2/3/4", configPath: "1/2/3/4/.mockery.yaml", }, { name: "test config at upper directory", - base_path: "1/2/3/4", + basePath: "1/2/3/4", configPath: "1/.mockery.yaml", }, { - name: "no config file found", - base_path: "1/2/3/4", + name: "no config file found", + basePath: "1/2/3/4", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tmpDir := pathlib.NewPath(t.TempDir()) - baseDir := tmpDir.Join(strings.Split(tt.base_path, "/")...) + baseDir := tmpDir.Join(strings.Split(tt.basePath, "/")...) require.NoError(t, baseDir.MkdirAll()) configPath := pathlib.NewPath("") @@ -164,7 +164,7 @@ packages: goModPath := pathlib.NewPath(tmpDir).Join("go.mod") err := goModPath.WriteFile([]byte(` module github.com/testuser/testpackage - + go 1.20`)) require.NoError(t, err) @@ -172,7 +172,7 @@ go 1.20`)) require.NoError(t, interfacePath.Parent().MkdirAll()) require.NoError(t, interfacePath.WriteFile([]byte(` package foopkg - + type FooInterface interface { Foo() Bar() diff --git a/pkg/fixtures/requester_unexported.go b/pkg/fixtures/requester_unexported.go index a7d29f5c..188c483a 100644 --- a/pkg/fixtures/requester_unexported.go +++ b/pkg/fixtures/requester_unexported.go @@ -1,5 +1,5 @@ package test -type requester_unexported interface { +type requesterUnexported interface { Get() } diff --git a/pkg/generator_test.go b/pkg/generator_test.go index 22f19b49..293ea2eb 100644 --- a/pkg/generator_test.go +++ b/pkg/generator_test.go @@ -226,7 +226,7 @@ func (s *GeneratorSuite) TestGeneratorNoNothing() { } func (s *GeneratorSuite) TestGeneratorUnexported() { - s.checkGeneration("requester_unexported.go", "requester_unexported", true, "", "") + s.checkGeneration("requester_unexported.go", "requesterUnexported", true, "", "") } func (s *GeneratorSuite) TestGeneratorPrologue() { diff --git a/pkg/logging/logging.go b/pkg/logging/logging.go index 0677cf8a..94126417 100644 --- a/pkg/logging/logging.go +++ b/pkg/logging/logging.go @@ -23,7 +23,8 @@ const ( LogKeyPath = "path" LogKeyQualifiedName = "qualified-name" LogKeyPackageName = "package-name" - _defaultSemVer = "v0.0.0-dev" + + defaultSemVer = "v0.0.0-dev" ) // SemVer is the version of mockery at build time. @@ -38,7 +39,7 @@ func GetSemverInfo() string { if ok && version.Main.Version != "(devel)" && version.Main.Version != "" { return version.Main.Version } - return _defaultSemVer + return defaultSemVer } func getMinorSemver(semver string) string {