diff --git a/cli/main_test.go b/cli/main_test.go index b2fabaf3d..be1f97dbf 100644 --- a/cli/main_test.go +++ b/cli/main_test.go @@ -40,7 +40,6 @@ func TestXDGConfigDirIsPrefferedFirst(t *testing.T) { } func TestHomeConfigDir(t *testing.T) { - homeDirPath := "/tmp-iofs/home/tester" AppFs.MkdirAll(homeDirPath, 0755) diff --git a/lint/filefilter_test.go b/lint/filefilter_test.go index 6c20afdcb..11da31374 100644 --- a/lint/filefilter_test.go +++ b/lint/filefilter_test.go @@ -95,7 +95,6 @@ func TestFileFilter(t *testing.T) { t.Fatalf("should not match %s", fn) } } - }) t.Run("just *", func(t *testing.T) { @@ -109,7 +108,6 @@ func TestFileFilter(t *testing.T) { t.Fatalf("should match %s", fn) } } - }) t.Run("just ~", func(t *testing.T) { @@ -123,6 +121,5 @@ func TestFileFilter(t *testing.T) { t.Fatalf("should match %s", fn) } } - }) } diff --git a/revivelib/core.go b/revivelib/core.go index 4e076e99f..31463fe64 100644 --- a/revivelib/core.go +++ b/revivelib/core.go @@ -82,7 +82,7 @@ func (r *Revive) Lint(patterns ...*LintPattern) (<-chan lint.Failure, error) { if len(excludePatterns) == 0 { // if no excludes were set excludePatterns = r.config.Exclude // use those from the configuration } - + // by default if no excludes exclude vendor if len(excludePatterns) == 0 { excludePatterns = []string{"vendor/..."} @@ -95,7 +95,6 @@ func (r *Revive) Lint(patterns ...*LintPattern) (<-chan lint.Failure, error) { revive := lint.New(func(file string) ([]byte, error) { contents, err := os.ReadFile(file) - if err != nil { return nil, fmt.Errorf("reading file %v: %w", file, err) } diff --git a/rule/enforce-map-style.go b/rule/enforce-map-style.go index 1c4717c2c..c698c40ed 100644 --- a/rule/enforce-map-style.go +++ b/rule/enforce-map-style.go @@ -65,7 +65,6 @@ func (r *EnforceMapStyleRule) configure(arguments lint.Arguments) { var err error r.enforceMapStyle, err = mapStyleFromString(enforceMapStyle) - if err != nil { panic(fmt.Sprintf("Invalid argument to the enforce-map-style rule: %v", err)) } diff --git a/rule/enforce-slice-style.go b/rule/enforce-slice-style.go index df72c8cef..14be25893 100644 --- a/rule/enforce-slice-style.go +++ b/rule/enforce-slice-style.go @@ -69,7 +69,6 @@ func (r *EnforceSliceStyleRule) configure(arguments lint.Arguments) { var err error r.enforceSliceStyle, err = sliceStyleFromString(enforceSliceStyle) - if err != nil { panic(fmt.Sprintf("Invalid argument to the enforce-slice-style rule: %v", err)) } diff --git a/rule/line-length-limit.go b/rule/line-length-limit.go index 1e91646b9..a154b7aec 100644 --- a/rule/line-length-limit.go +++ b/rule/line-length-limit.go @@ -38,7 +38,6 @@ func (r *LineLengthLimitRule) configure(arguments lint.Arguments) { } r.max = int(maxLength) - } // Apply applies the rule to given file. diff --git a/rule/max-public-structs.go b/rule/max-public-structs.go index ea93402a6..70840e734 100644 --- a/rule/max-public-structs.go +++ b/rule/max-public-structs.go @@ -35,7 +35,6 @@ func (r *MaxPublicStructsRule) configure(arguments lint.Arguments) { panic(`invalid value passed as argument number to the "max-public-structs" rule`) } r.max = maxStructs - } // Apply applies the rule to given file. diff --git a/rule/redefines-builtin-id.go b/rule/redefines-builtin-id.go index 8aaaf03d4..10ea16ae1 100644 --- a/rule/redefines-builtin-id.go +++ b/rule/redefines-builtin-id.go @@ -163,7 +163,7 @@ func (w *lintRedefinesBuiltinID) Visit(node ast.Node) ast.Visitor { if !isTypeOrName { continue } - + id := obj.Name if ok, bt := w.isBuiltIn(id); ok { w.addFailure(name, fmt.Sprintf("redefinition of the built-in %s %s", bt, id)) diff --git a/rule/var-naming.go b/rule/var-naming.go index e93159b20..9d9c73901 100644 --- a/rule/var-naming.go +++ b/rule/var-naming.go @@ -79,7 +79,6 @@ func (r *VarNamingRule) applyPackageCheckRules(walker *lintNames) { Category: "naming", }) } - } // Apply applies the rule to given file. diff --git a/test/json-data-format_test.go b/test/json-data-format_test.go index 3914b3155..41b154c33 100644 --- a/test/json-data-format_test.go +++ b/test/json-data-format_test.go @@ -9,9 +9,8 @@ import ( func TestJsonDataFormat(t *testing.T) { testRule(t, "json-data-format-atomic", &rule.AtomicRule{}) - } + func TestJsonDataFormatVarNaming(t *testing.T) { testRule(t, "json-data-format-var-naming", &rule.VarNamingRule{}, &lint.RuleConfig{}) - } diff --git a/test/utils_test.go b/test/utils_test.go index ad3686975..56af84219 100644 --- a/test/utils_test.go +++ b/test/utils_test.go @@ -107,11 +107,9 @@ func assertFailures(t *testing.T, baseDir string, fi os.FileInfo, src []byte, ru } if in.Confidence > 0 { - if in.Confidence != p.Confidence { t.Errorf("Lint failed at %s:%d; got confidence %f, want %f", fi.Name(), in.Line, p.Confidence, in.Confidence) } - } // remove this problem from ps @@ -224,11 +222,9 @@ func extractInstructionFromJSON(line string, lineNumber int) (instruction, error Line: lineNumber, } return ins, nil - } func extractDataMode(line string) string { - if strings.HasPrefix(line, "json") { return "json" } @@ -237,7 +233,6 @@ func extractDataMode(line string) string { } return "" - } func extractPattern(line string) (string, error) { diff --git a/test/var-naming_test.go b/test/var-naming_test.go index f55428670..9347385af 100644 --- a/test/var-naming_test.go +++ b/test/var-naming_test.go @@ -23,5 +23,4 @@ func TestVarNaming(t *testing.T) { testRule(t, "var-naming_skipPackageNameChecks-true", &rule.VarNamingRule{}, &lint.RuleConfig{ Arguments: []any{[]any{}, []any{}, []any{map[string]any{"skipPackageNameChecks": true}}}, }) - }