Skip to content

Commit

Permalink
fix issue #537 (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavacava authored Jun 29, 2021
1 parent cfac8b0 commit ea51f7a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ List of all available rules. The rules ported from `golint` are left unchanged a
| [`error-strings`](./RULES_DESCRIPTIONS.md#error-strings) | n/a | Conventions around error strings. | yes | no |
| [`error-naming`](./RULES_DESCRIPTIONS.md#error-naming) | n/a | Naming of error variables. | yes | no |
| [`exported`](./RULES_DESCRIPTIONS.md#exported) | n/a | Naming and commenting conventions on exported symbols. | yes | no |
| [`if-return`](./RULES_DESCRIPTIONS.md#if-return) | n/a | Redundant if when returning an error. | yes | no |
| [`if-return`](./RULES_DESCRIPTIONS.md#if-return) | n/a | Redundant if when returning an error. | no | no |
| [`increment-decrement`](./RULES_DESCRIPTIONS.md#increment-decrement) | n/a | Use `i++` and `i--` instead of `i += 1` and `i -= 1`. | yes | no |
| [`var-naming`](./RULES_DESCRIPTIONS.md#var-naming) | whitelist & blacklist of initialisms | Naming rules. | yes | no |
| [`package-comments`](./RULES_DESCRIPTIONS.md#package-comments) | n/a | Package commenting conventions. | yes | no |
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var defaultRules = []lint.Rule{
&rule.ExportedRule{},
&rule.VarNamingRule{},
&rule.IndentErrorFlowRule{},
&rule.IfReturnRule{},
&rule.RangeRule{},
&rule.ErrorfRule{},
&rule.ErrorNamingRule{},
Expand Down Expand Up @@ -80,6 +79,7 @@ var allRules = append([]lint.Rule{
&rule.UnexportedNamingRule{},
&rule.FunctionLength{},
&rule.NestedStructs{},
&rule.IfReturnRule{},
}, defaultRules...)

var allFormatters = []lint.Formatter{
Expand Down
1 change: 0 additions & 1 deletion test/golint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ var rules = []lint.Rule{
&rule.ExportedRule{},
&rule.VarNamingRule{},
&rule.IndentErrorFlowRule{},
&rule.IfReturnRule{},
&rule.RangeRule{},
&rule.ErrorfRule{},
&rule.ErrorNamingRule{},
Expand Down
12 changes: 12 additions & 0 deletions test/if-return_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package test

import (
"testing"

"github.com/mgechev/revive/rule"
)

// TestIfReturn rule.
func TestIfReturn(t *testing.T) {
testRule(t, "if-return", &rule.IfReturnRule{})
}
File renamed without changes.

0 comments on commit ea51f7a

Please sign in to comment.