diff --git a/README.md b/README.md index 3e51462..7c6809c 100644 --- a/README.md +++ b/README.md @@ -350,6 +350,8 @@ List of all available rules. The rules ported from `golint` are left unchanged a | [`cognitive-complexity`](./RULES_DESCRIPTIONS.md#cognitive-complexity) | int | Sets restriction for maximum Cognitive complexity. | no | no | | [`string-of-int`](./RULES_DESCRIPTIONS.md#string-of-int) | n/a | Warns on suspicious casts from int to string | no | yes | | [`early-return`](./RULES_DESCRIPTIONS.md#early-return) | n/a | Spots if-then-else statements that can be refactored to simplify code reading | no | no | +| [`identical-branches`](./RULES_DESCRIPTIONS.md#identical-branches) | n/a | Spots if-then-else statements with identical `then` and `else` branches | no | no | + ## Configurable rules Here you can find how you can configure some of the existing rules: diff --git a/RULES_DESCRIPTIONS.md b/RULES_DESCRIPTIONS.md index 901543c..4cedcd9 100644 --- a/RULES_DESCRIPTIONS.md +++ b/RULES_DESCRIPTIONS.md @@ -33,6 +33,7 @@ List of all available rules. - [flag-parameter](#flag-parameter) - [function-result-limit](#function-result-limit) - [get-return](#get-return) + - [identical-branches](#identical-branches) - [if-return](#if-return) - [increment-decrement](#increment-decrement) - [indent-error-flow](#indent-error-flow) @@ -313,6 +314,12 @@ _Description_: Typically, functions with names prefixed with _Get_ are supposed _Configuration_: N/A +## identical-branches + +_Description_: an `if-then-else` conditional with identical implementations in both branches is an error. + +_Configuration_: N/A + ## if-return _Description_: Checking if an error is _nil_ to just after return the error or nil is redundant.