1
0
mirror of https://github.com/mgechev/revive.git synced 2025-03-17 20:57:58 +02:00
This commit is contained in:
SalvadorC 2021-06-29 22:04:51 +02:00 committed by GitHub
parent cfac8b0013
commit ea51f7aa3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 3 deletions

View File

@ -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 |

View File

@ -20,7 +20,6 @@ var defaultRules = []lint.Rule{
&rule.ExportedRule{},
&rule.VarNamingRule{},
&rule.IndentErrorFlowRule{},
&rule.IfReturnRule{},
&rule.RangeRule{},
&rule.ErrorfRule{},
&rule.ErrorNamingRule{},
@ -80,6 +79,7 @@ var allRules = append([]lint.Rule{
&rule.UnexportedNamingRule{},
&rule.FunctionLength{},
&rule.NestedStructs{},
&rule.IfReturnRule{},
}, defaultRules...)
var allFormatters = []lint.Formatter{

View File

@ -21,7 +21,6 @@ var rules = []lint.Rule{
&rule.ExportedRule{},
&rule.VarNamingRule{},
&rule.IndentErrorFlowRule{},
&rule.IfReturnRule{},
&rule.RangeRule{},
&rule.ErrorfRule{},
&rule.ErrorNamingRule{},

12
test/if-return_test.go Normal file
View File

@ -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{})
}