mirror of
https://github.com/mgechev/revive.git
synced 2025-11-27 22:18:41 +02:00
chore: remove unnecessary empty lines (#1080)
This commit is contained in:
@@ -40,7 +40,6 @@ func TestXDGConfigDirIsPrefferedFirst(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestHomeConfigDir(t *testing.T) {
|
func TestHomeConfigDir(t *testing.T) {
|
||||||
|
|
||||||
homeDirPath := "/tmp-iofs/home/tester"
|
homeDirPath := "/tmp-iofs/home/tester"
|
||||||
AppFs.MkdirAll(homeDirPath, 0755)
|
AppFs.MkdirAll(homeDirPath, 0755)
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ func TestFileFilter(t *testing.T) {
|
|||||||
t.Fatalf("should not match %s", fn)
|
t.Fatalf("should not match %s", fn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("just *", func(t *testing.T) {
|
t.Run("just *", func(t *testing.T) {
|
||||||
@@ -109,7 +108,6 @@ func TestFileFilter(t *testing.T) {
|
|||||||
t.Fatalf("should match %s", fn)
|
t.Fatalf("should match %s", fn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("just ~", func(t *testing.T) {
|
t.Run("just ~", func(t *testing.T) {
|
||||||
@@ -123,6 +121,5 @@ func TestFileFilter(t *testing.T) {
|
|||||||
t.Fatalf("should match %s", fn)
|
t.Fatalf("should match %s", fn)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ func (r *Revive) Lint(patterns ...*LintPattern) (<-chan lint.Failure, error) {
|
|||||||
|
|
||||||
revive := lint.New(func(file string) ([]byte, error) {
|
revive := lint.New(func(file string) ([]byte, error) {
|
||||||
contents, err := os.ReadFile(file)
|
contents, err := os.ReadFile(file)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("reading file %v: %w", file, err)
|
return nil, fmt.Errorf("reading file %v: %w", file, err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ func (r *EnforceMapStyleRule) configure(arguments lint.Arguments) {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
r.enforceMapStyle, err = mapStyleFromString(enforceMapStyle)
|
r.enforceMapStyle, err = mapStyleFromString(enforceMapStyle)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("Invalid argument to the enforce-map-style rule: %v", err))
|
panic(fmt.Sprintf("Invalid argument to the enforce-map-style rule: %v", err))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,6 @@ func (r *EnforceSliceStyleRule) configure(arguments lint.Arguments) {
|
|||||||
|
|
||||||
var err error
|
var err error
|
||||||
r.enforceSliceStyle, err = sliceStyleFromString(enforceSliceStyle)
|
r.enforceSliceStyle, err = sliceStyleFromString(enforceSliceStyle)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Sprintf("Invalid argument to the enforce-slice-style rule: %v", err))
|
panic(fmt.Sprintf("Invalid argument to the enforce-slice-style rule: %v", err))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ func (r *LineLengthLimitRule) configure(arguments lint.Arguments) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
r.max = int(maxLength)
|
r.max = int(maxLength)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply applies the rule to given file.
|
// Apply applies the rule to given 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`)
|
panic(`invalid value passed as argument number to the "max-public-structs" rule`)
|
||||||
}
|
}
|
||||||
r.max = maxStructs
|
r.max = maxStructs
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply applies the rule to given file.
|
// Apply applies the rule to given file.
|
||||||
|
|||||||
@@ -79,7 +79,6 @@ func (r *VarNamingRule) applyPackageCheckRules(walker *lintNames) {
|
|||||||
Category: "naming",
|
Category: "naming",
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply applies the rule to given file.
|
// Apply applies the rule to given file.
|
||||||
|
|||||||
@@ -9,9 +9,8 @@ import (
|
|||||||
|
|
||||||
func TestJsonDataFormat(t *testing.T) {
|
func TestJsonDataFormat(t *testing.T) {
|
||||||
testRule(t, "json-data-format-atomic", &rule.AtomicRule{})
|
testRule(t, "json-data-format-atomic", &rule.AtomicRule{})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestJsonDataFormatVarNaming(t *testing.T) {
|
func TestJsonDataFormatVarNaming(t *testing.T) {
|
||||||
testRule(t, "json-data-format-var-naming", &rule.VarNamingRule{}, &lint.RuleConfig{})
|
testRule(t, "json-data-format-var-naming", &rule.VarNamingRule{}, &lint.RuleConfig{})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,11 +107,9 @@ func assertFailures(t *testing.T, baseDir string, fi os.FileInfo, src []byte, ru
|
|||||||
}
|
}
|
||||||
|
|
||||||
if in.Confidence > 0 {
|
if in.Confidence > 0 {
|
||||||
|
|
||||||
if in.Confidence != p.Confidence {
|
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)
|
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
|
// remove this problem from ps
|
||||||
@@ -224,11 +222,9 @@ func extractInstructionFromJSON(line string, lineNumber int) (instruction, error
|
|||||||
Line: lineNumber,
|
Line: lineNumber,
|
||||||
}
|
}
|
||||||
return ins, nil
|
return ins, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractDataMode(line string) string {
|
func extractDataMode(line string) string {
|
||||||
|
|
||||||
if strings.HasPrefix(line, "json") {
|
if strings.HasPrefix(line, "json") {
|
||||||
return "json"
|
return "json"
|
||||||
}
|
}
|
||||||
@@ -237,7 +233,6 @@ func extractDataMode(line string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func extractPattern(line string) (string, error) {
|
func extractPattern(line string) (string, error) {
|
||||||
|
|||||||
@@ -23,5 +23,4 @@ func TestVarNaming(t *testing.T) {
|
|||||||
testRule(t, "var-naming_skipPackageNameChecks-true", &rule.VarNamingRule{}, &lint.RuleConfig{
|
testRule(t, "var-naming_skipPackageNameChecks-true", &rule.VarNamingRule{}, &lint.RuleConfig{
|
||||||
Arguments: []any{[]any{}, []any{}, []any{map[string]any{"skipPackageNameChecks": true}}},
|
Arguments: []any{[]any{}, []any{}, []any{map[string]any{"skipPackageNameChecks": true}}},
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user