From 4eb7ae0821dc1e3267d44cf83ed7b3e958290e23 Mon Sep 17 00:00:00 2001 From: chavacava Date: Sat, 9 May 2020 17:19:37 +0200 Subject: [PATCH] documents unconditional-recursion --- README.md | 2 ++ RULES_DESCRIPTIONS.md | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 3e51462..6529d35 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 | +| [`unconditional-recursion`](./RULES_DESCRIPTIONS.md#unconditional-recursion) | n/a | Warns on function calls that will lead to (direct) infinite recursion | 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..2f9efba 100644 --- a/RULES_DESCRIPTIONS.md +++ b/RULES_DESCRIPTIONS.md @@ -54,6 +54,7 @@ List of all available rules. - [time-naming](#time-naming) - [var-naming](#var-naming) - [var-declaration](#var-declaration) + - [unconditional-recursion](#unconditional-recursion) - [unexported-return](#unexported-return) - [unhandled-error](#unhandled-error) - [unnecessary-stmt](#unnecessary-stmt) @@ -482,6 +483,12 @@ _Description_: This rule proposes simplifications of variable declarations. _Configuration_: N/A +## unconditional-recursion + +_Description_: Unconditional recursive calls will produce infinite recursion, thus program stack overflow. This rule detect and warns about unconditional (direct) recursive calls. + +_Configuration_: N/A + ## unexported-return _Description_: This rule warns when an exported function or method returns a value of an un-exported type.