mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
cocuments cognitive-complexity
This commit is contained in:
@@ -346,6 +346,7 @@ List of all available rules. The rules ported from `golint` are left unchanged a
|
||||
| [`bare-return`](./RULES_DESCRIPTIONS.md#bare-return) | n/a | Warns on bare returns | no | no |
|
||||
| [`unused-receiver`](./RULES_DESCRIPTIONS.md#unused-receiver) | n/a | Suggests to rename or remove unused method receivers | no | no |
|
||||
| [`unhandled-error`](./RULES_DESCRIPTIONS.md#unhandled-error) | []string | Warns on unhandled errors returned by funcion calls | no | yes |
|
||||
| [`cognitive-complexity`](./RULES_DESCRIPTIONS.md#cognitive-complexity) | int | Sets restriction for maximum Cognitive complexity. | no | no |
|
||||
|
||||
## Configurable rules
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ List of all available rules.
|
||||
- [call-to-gc](#call-to-gc)
|
||||
- [confusing-naming](#confusing-naming)
|
||||
- [confusing-results](#confusing-results)
|
||||
- [cognitive-complexity](#cognitive-complexity)
|
||||
- [constant-logical-expr](#constant-logical-expr)
|
||||
- [context-as-argument](#context-as-argument)
|
||||
- [context-keys-type](#context-keys-type)
|
||||
@@ -122,6 +123,19 @@ The garbage collector can be configured through environment variables as describ
|
||||
|
||||
_Configuration_: N/A
|
||||
|
||||
## cognitive-complexity
|
||||
|
||||
_Description_: [Cognitive complexity](https://www.sonarsource.com/resources/white-papers/cognitive-complexity.html) is a measure of how hard code is to understand. Enforcing a maximum complexity per function helps to keep code readable and maintainable.
|
||||
|
||||
_Configuration_: (int) the maximum function complexity
|
||||
|
||||
Example:
|
||||
|
||||
```toml
|
||||
[rule.cognitive-complexity]
|
||||
arguments =[7]
|
||||
```
|
||||
|
||||
## confusing-naming
|
||||
|
||||
_Description_: Methods or fields of `struct` that have names different only by capitalization could be confusing.
|
||||
|
||||
Reference in New Issue
Block a user