Skip to content

Commit

Permalink
refactor: rename files to follow Go convention
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandear authored and chavacava committed Nov 11, 2024
1 parent c0d4d07 commit be95bfa
Show file tree
Hide file tree
Showing 299 changed files with 181 additions and 178 deletions.
3 changes: 3 additions & 0 deletions revive.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions revivelib/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/add-constant_test.go → test/add_constant_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
})
}
2 changes: 1 addition & 1 deletion test/bare-return_test.go → test/bare_return_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import (
)

func TestBareReturn(t *testing.T) {
testRule(t, "bare-return", &rule.BareReturnRule{})
testRule(t, "bare_return", &rule.BareReturnRule{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}
2 changes: 1 addition & 1 deletion test/call-to-gc_test.go → test/call_to_gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"}},
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import (

// TestConfusingNaming rule.
func TestConfusingNaming(t *testing.T) {
testRule(t, "confusing-naming1", &rule.ConfusingNamingRule{})
testRule(t, "confusing_naming1", &rule.ConfusingNamingRule{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import (
)

func TestConfusingResults(t *testing.T) {
testRule(t, "confusing-results", &rule.ConfusingResultsRule{})
testRule(t, "confusing_results", &rule.ConfusingResultsRule{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion test/cyclomatic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
})
}
4 changes: 2 additions & 2 deletions test/deep-exit_test.go → test/deep_exit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}
4 changes: 2 additions & 2 deletions test/defer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
}
2 changes: 1 addition & 1 deletion test/dot_imports_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import (
)

func TestDuplicatedImports(t *testing.T) {
testRule(t, "duplicated-imports", &rule.DuplicatedImportsRule{})
testRule(t, "duplicated_imports", &rule.DuplicatedImportsRule{})
}
4 changes: 2 additions & 2 deletions test/early-return_test.go → test/early_return_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}})
}
2 changes: 1 addition & 1 deletion test/empty-block_test.go → test/empty_block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import (

// TestEmptyBlock rule.
func TestEmptyBlock(t *testing.T) {
testRule(t, "empty-block", &rule.EmptyBlockRule{})
testRule(t, "empty_block", &rule.EmptyBlockRule{})
}
2 changes: 1 addition & 1 deletion test/empty-lines_test.go → test/empty_lines_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import (

// TestEmptyLines rule.
func TestEmptyLines(t *testing.T) {
testRule(t, "empty-lines", &rule.EmptyLinesRule{})
testRule(t, "empty_lines", &rule.EmptyLinesRule{})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand All @@ -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`,
Expand All @@ -56,22 +56,22 @@ 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`,
"funcRetValStyle": `any`,
},
},
})
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`,
Expand All @@ -80,22 +80,22 @@ 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`,
"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": `short`,
Expand All @@ -104,15 +104,15 @@ 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`,
"funcRetValStyle": `short`,
},
},
})
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`,
Expand Down
Loading

0 comments on commit be95bfa

Please sign in to comment.