Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 692 Bytes

cognitive-complexity.md

File metadata and controls

24 lines (15 loc) · 692 Bytes

Pattern: Cognitive complexity is too high

Issue: -

Description

Cognitive complexity is a measure of how hard code is to understand. While cyclomatic complexity is good to measure "testability" of the code, cognitive complexity aims to provide a more precise measure of the difficulty of understanding the code. Enforcing a maximum complexity per function helps to keep code readable and maintainable.

Configuration

(int) the maximum function complexity

Example:

[rule.cognitive-complexity]
  arguments =[7]

Further Reading