Skip to content

Drop if-return from default ruleset #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ warningCode = 0
[rule.error-strings]
[rule.error-naming]
[rule.exported]
[rule.if-return]
[rule.increment-decrement]
[rule.var-naming]
[rule.var-declaration]
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ var defaultRules = []lint.Rule{
&rule.TimeNamingRule{},
&rule.ContextKeysType{},
&rule.ContextAsArgumentRule{},
&rule.IfReturnRule{},
&rule.EmptyBlockRule{},
&rule.SuperfluousElseRule{},
&rule.UnusedParamRule{},
Expand Down Expand Up @@ -87,6 +86,7 @@ var allRules = append([]lint.Rule{
&rule.UseAnyRule{},
&rule.DataRaceRule{},
&rule.CommentSpacingsRule{},
&rule.IfReturnRule{},
}, defaultRules...)

var allFormatters = []lint.Formatter{
Expand Down
1 change: 0 additions & 1 deletion defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ warningCode = 0
[rule.error-strings]
[rule.error-naming]
[rule.exported]
[rule.if-return]
[rule.increment-decrement]
[rule.var-naming]
[rule.var-declaration]
Expand Down
6 changes: 3 additions & 3 deletions revivelib/core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/mgechev/revive/config"
"github.com/mgechev/revive/lint"
"github.com/mgechev/revive/revivelib"
"github.com/mgechev/revive/rule"
)

func TestReviveLint(t *testing.T) {
Expand Down Expand Up @@ -45,7 +46,6 @@ func TestReviveFormat(t *testing.T) {

// ACT
failures, exitCode, err := revive.Format("stylish", failuresChan)

// ASSERT
if err != nil {
t.Fatal(err)
Expand All @@ -70,8 +70,7 @@ func TestReviveFormat(t *testing.T) {
}
}

type mockRule struct {
}
type mockRule struct{}

func (r *mockRule) Name() string {
return "mock-rule"
Expand All @@ -93,6 +92,7 @@ func getMockRevive(t *testing.T) *revivelib.Revive {
conf,
true,
2048,
revivelib.NewExtraRule(&rule.IfReturnRule{}, lint.RuleConfig{}),
revivelib.NewExtraRule(&mockRule{}, lint.RuleConfig{}),
)
if err != nil {
Expand Down