mirror of
https://github.com/mgechev/revive.git
synced 2024-11-21 17:16:40 +02:00
refactor: rename files to follow Go convention
This commit is contained in:
parent
c0d4d07ab6
commit
be95bfa705
@ -19,6 +19,9 @@ warningCode = 1
|
||||
[rule.error-strings]
|
||||
[rule.errorf]
|
||||
[rule.exported]
|
||||
[rule.filename-format]
|
||||
# Override the default pattern to forbid .go files with uppercase letters and dashes.
|
||||
arguments=["^[_a-z][_a-z0-9]*.go$"]
|
||||
[rule.increment-decrement]
|
||||
[rule.indent-error-flow]
|
||||
[rule.line-length-limit]
|
||||
|
@ -16,7 +16,7 @@ func TestReviveLint(t *testing.T) {
|
||||
revive := getMockRevive(t)
|
||||
|
||||
// ACT
|
||||
failures, err := revive.Lint(revivelib.Include("../testdata/if-return.go"))
|
||||
failures, err := revive.Lint(revivelib.Include("../testdata/if_return.go"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -40,7 +40,7 @@ func TestReviveFormat(t *testing.T) {
|
||||
// ARRANGE
|
||||
revive := getMockRevive(t)
|
||||
|
||||
failuresChan, err := revive.Lint(revivelib.Include("../testdata/if-return.go"))
|
||||
failuresChan, err := revive.Lint(revivelib.Include("../testdata/if_return.go"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ func TestAddConstant(t *testing.T) {
|
||||
"ignoreFuncs": "os\\.(CreateFile|WriteFile|Chmod|FindProcess),\\.Println,ignoredFunc,\\.Info",
|
||||
}}
|
||||
|
||||
testRule(t, "add-constant", &rule.AddConstantRule{}, &lint.RuleConfig{
|
||||
testRule(t, "add_constant", &rule.AddConstantRule{}, &lint.RuleConfig{
|
||||
Arguments: args,
|
||||
})
|
||||
}
|
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestArgumentLimit(t *testing.T) {
|
||||
testRule(t, "argument-limit", &rule.ArgumentsLimitRule{}, &lint.RuleConfig{
|
||||
testRule(t, "argument_limit", &rule.ArgumentsLimitRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{int64(3)},
|
||||
})
|
||||
}
|
@ -11,7 +11,7 @@ import (
|
||||
// One banned character is in the comment and should not be checked.
|
||||
// One banned character from the list is not present in the fixture file.
|
||||
func TestBannedCharacters(t *testing.T) {
|
||||
testRule(t, "banned-characters", &rule.BannedCharsRule{}, &lint.RuleConfig{
|
||||
testRule(t, "banned_characters", &rule.BannedCharsRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"Ω", "Σ", "σ", "1"},
|
||||
})
|
||||
}
|
@ -7,5 +7,5 @@ import (
|
||||
)
|
||||
|
||||
func TestBareReturn(t *testing.T) {
|
||||
testRule(t, "bare-return", &rule.BareReturnRule{})
|
||||
testRule(t, "bare_return", &rule.BareReturnRule{})
|
||||
}
|
@ -8,5 +8,5 @@ import (
|
||||
|
||||
// BoolLiteral rule.
|
||||
func TestBoolLiteral(t *testing.T) {
|
||||
testRule(t, "bool-literal-in-expr", &rule.BoolLiteralRule{})
|
||||
testRule(t, "bool_literal_in_expr", &rule.BoolLiteralRule{})
|
||||
}
|
@ -8,5 +8,5 @@ import (
|
||||
|
||||
// TestCallToGC test call-to-gc rule
|
||||
func TestCallToGC(t *testing.T) {
|
||||
testRule(t, "call-to-gc", &rule.CallToGCRule{})
|
||||
testRule(t, "call_to_gc", &rule.CallToGCRule{})
|
||||
}
|
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCognitiveComplexity(t *testing.T) {
|
||||
testRule(t, "cognitive-complexity", &rule.CognitiveComplexityRule{}, &lint.RuleConfig{
|
||||
testRule(t, "cognitive_complexity", &rule.CognitiveComplexityRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{int64(0)},
|
||||
})
|
||||
}
|
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCommentSpacings(t *testing.T) {
|
||||
testRule(t, "comment-spacings", &rule.CommentSpacingsRule{}, &lint.RuleConfig{
|
||||
testRule(t, "comment_spacings", &rule.CommentSpacingsRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"myOwnDirective:", "+optional"}},
|
||||
)
|
||||
}
|
@ -8,13 +8,13 @@ import (
|
||||
)
|
||||
|
||||
func TestCommentsDensity(t *testing.T) {
|
||||
testRule(t, "comments-density-1", &rule.CommentsDensityRule{}, &lint.RuleConfig{
|
||||
testRule(t, "comments_density_1", &rule.CommentsDensityRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{int64(60)},
|
||||
})
|
||||
|
||||
testRule(t, "comments-density-2", &rule.CommentsDensityRule{}, &lint.RuleConfig{
|
||||
testRule(t, "comments_density_2", &rule.CommentsDensityRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{int64(90)},
|
||||
})
|
||||
|
||||
testRule(t, "comments-density-3", &rule.CommentsDensityRule{}, &lint.RuleConfig{})
|
||||
testRule(t, "comments_density_3", &rule.CommentsDensityRule{}, &lint.RuleConfig{})
|
||||
}
|
@ -8,5 +8,5 @@ import (
|
||||
|
||||
// TestConfusingNaming rule.
|
||||
func TestConfusingNaming(t *testing.T) {
|
||||
testRule(t, "confusing-naming1", &rule.ConfusingNamingRule{})
|
||||
testRule(t, "confusing_naming1", &rule.ConfusingNamingRule{})
|
||||
}
|
@ -7,5 +7,5 @@ import (
|
||||
)
|
||||
|
||||
func TestConfusingResults(t *testing.T) {
|
||||
testRule(t, "confusing-results", &rule.ConfusingResultsRule{})
|
||||
testRule(t, "confusing_results", &rule.ConfusingResultsRule{})
|
||||
}
|
@ -8,5 +8,5 @@ import (
|
||||
|
||||
// ConstantLogicalExpr rule.
|
||||
func TestConstantLogicalExpr(t *testing.T) {
|
||||
testRule(t, "constant-logical-expr", &rule.ConstantLogicalExprRule{})
|
||||
testRule(t, "constant_logical_expr", &rule.ConstantLogicalExprRule{})
|
||||
}
|
@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestContextAsArgument(t *testing.T) {
|
||||
testRule(t, "context-as-argument", &rule.ContextAsArgumentRule{}, &lint.RuleConfig{
|
||||
testRule(t, "context_as_argument", &rule.ContextAsArgumentRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"allowTypesBefore": "AllowedBeforeType,AllowedBeforeStruct,*AllowedBeforePtrStruct,*testing.T",
|
@ -11,7 +11,7 @@ func TestCyclomatic(t *testing.T) {
|
||||
testRule(t, "cyclomatic", &rule.CyclomaticRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{int64(1)},
|
||||
})
|
||||
testRule(t, "cyclomatic-2", &rule.CyclomaticRule{}, &lint.RuleConfig{
|
||||
testRule(t, "cyclomatic_2", &rule.CyclomaticRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{int64(3)},
|
||||
})
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ import (
|
||||
)
|
||||
|
||||
func TestDeepExit(t *testing.T) {
|
||||
testRule(t, "deep-exit", &rule.DeepExitRule{})
|
||||
testRule(t, "deep-exit_test", &rule.DeepExitRule{})
|
||||
testRule(t, "deep_exit", &rule.DeepExitRule{})
|
||||
testRule(t, "deep_exit_test", &rule.DeepExitRule{})
|
||||
}
|
@ -13,13 +13,13 @@ func TestDefer(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeferLoopDisabled(t *testing.T) {
|
||||
testRule(t, "defer-loop-disabled", &rule.DeferRule{}, &lint.RuleConfig{
|
||||
testRule(t, "defer_loop_disabled", &rule.DeferRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{[]any{"return", "recover", "call-chain", "method-call"}},
|
||||
})
|
||||
}
|
||||
|
||||
func TestDeferOthersDisabled(t *testing.T) {
|
||||
testRule(t, "defer-only-loop-enabled", &rule.DeferRule{}, &lint.RuleConfig{
|
||||
testRule(t, "defer_only_loop_enabled", &rule.DeferRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{[]any{"loop"}},
|
||||
})
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ import (
|
||||
)
|
||||
|
||||
func TestDisabledAnnotations(t *testing.T) {
|
||||
testRule(t, "disable-annotations", &rule.ExportedRule{}, &lint.RuleConfig{})
|
||||
testRule(t, "disable_annotations", &rule.ExportedRule{}, &lint.RuleConfig{})
|
||||
}
|
||||
|
||||
func TestModifiedAnnotations(t *testing.T) {
|
||||
testRule(t, "disable-annotations2", &rule.VarNamingRule{}, &lint.RuleConfig{})
|
||||
testRule(t, "disable_annotations2", &rule.VarNamingRule{}, &lint.RuleConfig{})
|
||||
}
|
||||
|
||||
func TestDisableNextLineAnnotations(t *testing.T) {
|
||||
testRule(t, "disable-annotations3", &rule.VarNamingRule{}, &lint.RuleConfig{})
|
||||
testRule(t, "disable_annotations3", &rule.VarNamingRule{}, &lint.RuleConfig{})
|
||||
}
|
@ -12,7 +12,7 @@ func TestDotImports(t *testing.T) {
|
||||
"allowedPackages": []any{"errors", "context", "github.com/BurntSushi/toml"},
|
||||
}}
|
||||
|
||||
testRule(t, "import-dot", &rule.DotImportsRule{}, &lint.RuleConfig{
|
||||
testRule(t, "import_dot", &rule.DotImportsRule{}, &lint.RuleConfig{
|
||||
Arguments: args,
|
||||
})
|
||||
}
|
||||
|
@ -7,5 +7,5 @@ import (
|
||||
)
|
||||
|
||||
func TestDuplicatedImports(t *testing.T) {
|
||||
testRule(t, "duplicated-imports", &rule.DuplicatedImportsRule{})
|
||||
testRule(t, "duplicated_imports", &rule.DuplicatedImportsRule{})
|
||||
}
|
@ -10,6 +10,6 @@ import (
|
||||
|
||||
// TestEarlyReturn tests early-return rule.
|
||||
func TestEarlyReturn(t *testing.T) {
|
||||
testRule(t, "early-return", &rule.EarlyReturnRule{})
|
||||
testRule(t, "early-return-scope", &rule.EarlyReturnRule{}, &lint.RuleConfig{Arguments: []any{ifelse.PreserveScope}})
|
||||
testRule(t, "early_return", &rule.EarlyReturnRule{})
|
||||
testRule(t, "early_return_scope", &rule.EarlyReturnRule{}, &lint.RuleConfig{Arguments: []any{ifelse.PreserveScope}})
|
||||
}
|
@ -8,5 +8,5 @@ import (
|
||||
|
||||
// TestEmptyBlock rule.
|
||||
func TestEmptyBlock(t *testing.T) {
|
||||
testRule(t, "empty-block", &rule.EmptyBlockRule{})
|
||||
testRule(t, "empty_block", &rule.EmptyBlockRule{})
|
||||
}
|
@ -8,5 +8,5 @@ import (
|
||||
|
||||
// TestEmptyLines rule.
|
||||
func TestEmptyLines(t *testing.T) {
|
||||
testRule(t, "empty-lines", &rule.EmptyLinesRule{})
|
||||
testRule(t, "empty_lines", &rule.EmptyLinesRule{})
|
||||
}
|
@ -8,17 +8,17 @@ import (
|
||||
)
|
||||
|
||||
func TestEnforceMapStyle_any(t *testing.T) {
|
||||
testRule(t, "enforce-map-style-any", &rule.EnforceMapStyleRule{})
|
||||
testRule(t, "enforce_map_style_any", &rule.EnforceMapStyleRule{})
|
||||
}
|
||||
|
||||
func TestEnforceMapStyle_make(t *testing.T) {
|
||||
testRule(t, "enforce-map-style-make", &rule.EnforceMapStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_map_style_make", &rule.EnforceMapStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"make"},
|
||||
})
|
||||
}
|
||||
|
||||
func TestEnforceMapStyle_literal(t *testing.T) {
|
||||
testRule(t, "enforce-map-style-literal", &rule.EnforceMapStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_map_style_literal", &rule.EnforceMapStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"literal"},
|
||||
})
|
||||
}
|
@ -8,21 +8,21 @@ import (
|
||||
)
|
||||
|
||||
func TestEnforceRepeatedArgTypeStyleShort(t *testing.T) {
|
||||
testRule(t, "enforce-repeated-arg-type-style-short-args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_short_args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"short"},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-short-return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_short_return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"short"},
|
||||
})
|
||||
|
||||
testRule(t, "enforce-repeated-arg-type-style-short-args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_short_args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `short`,
|
||||
},
|
||||
},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-short-return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_short_return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcRetValStyle": `short`,
|
||||
@ -32,21 +32,21 @@ func TestEnforceRepeatedArgTypeStyleShort(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEnforceRepeatedArgTypeStyleFull(t *testing.T) {
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"full"},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{"full"},
|
||||
})
|
||||
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `full`,
|
||||
},
|
||||
},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcRetValStyle": `full`,
|
||||
@ -56,14 +56,14 @@ func TestEnforceRepeatedArgTypeStyleFull(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEnforceRepeatedArgTypeStyleMixed(t *testing.T) {
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `full`,
|
||||
},
|
||||
},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `full`,
|
||||
@ -71,7 +71,7 @@ func TestEnforceRepeatedArgTypeStyleMixed(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_args", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `full`,
|
||||
@ -80,14 +80,14 @@ func TestEnforceRepeatedArgTypeStyleMixed(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcRetValStyle": `full`,
|
||||
},
|
||||
},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `any`,
|
||||
@ -95,7 +95,7 @@ func TestEnforceRepeatedArgTypeStyleMixed(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-full-return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_full_return", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `short`,
|
||||
@ -104,7 +104,7 @@ func TestEnforceRepeatedArgTypeStyleMixed(t *testing.T) {
|
||||
},
|
||||
})
|
||||
|
||||
testRule(t, "enforce-repeated-arg-type-style-mixed-full-short", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_mixed_full_short", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `full`,
|
||||
@ -112,7 +112,7 @@ func TestEnforceRepeatedArgTypeStyleMixed(t *testing.T) {
|
||||
},
|
||||
},
|
||||
})
|
||||
testRule(t, "enforce-repeated-arg-type-style-mixed-short-full", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
testRule(t, "enforce_repeated_arg_type_style_mixed_short_full", &rule.EnforceRepeatedArgTypeStyleRule{}, &lint.RuleConfig{
|
||||
Arguments: []any{
|
||||
map[string]any{
|
||||
"funcArgStyle": `short`,
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user