1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-21 17:16:40 +02:00

chore: remove unnecessary empty lines (#1080)

This commit is contained in:
Oleksandr Redko 2024-10-26 13:35:02 +03:00 committed by GitHub
parent ad0f03a03f
commit 599874c773
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 3 additions and 20 deletions

View File

@ -40,7 +40,6 @@ func TestXDGConfigDirIsPrefferedFirst(t *testing.T) {
}
func TestHomeConfigDir(t *testing.T) {
homeDirPath := "/tmp-iofs/home/tester"
AppFs.MkdirAll(homeDirPath, 0755)

View File

@ -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)
}
}
})
}

View File

@ -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)
}

View File

@ -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))
}

View File

@ -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))
}

View File

@ -38,7 +38,6 @@ func (r *LineLengthLimitRule) configure(arguments lint.Arguments) {
}
r.max = int(maxLength)
}
// Apply applies the rule to given file.

View File

@ -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.

View File

@ -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))

View File

@ -79,7 +79,6 @@ func (r *VarNamingRule) applyPackageCheckRules(walker *lintNames) {
Category: "naming",
})
}
}
// Apply applies the rule to given file.

View File

@ -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{})
}

View File

@ -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) {

View File

@ -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}}},
})
}