diff --git a/docs/insights/complexity.md b/docs/insights/complexity.md index c6268c4a..e53925d8 100644 --- a/docs/insights/complexity.md +++ b/docs/insights/complexity.md @@ -1,12 +1,12 @@ # Complexity -For now the Complexity section is only one Insight in one Metric: +For now the Complexity section is only one Metric consisting of multiple insights: * `NunoMaduro\PhpInsights\Domain\Metrics\Complexity\Complexity` -## Cyclomatic Complexity is high +## Class Cyclomatic Complexity is high -This insight checks complexity cyclomatic on your classes, the lower the score the easier your code is to understand. It raises an issue if complexity is over `5`. +This insight checks total method cyclomatic complexity of each class, the lower the score the easier your code is to understand. It raises an issue if complexity is over `5`. **Insight Class**: `NunoMaduro\PhpInsights\Domain\Insights\CyclomaticComplexityIsHigh` @@ -20,6 +20,38 @@ This insight checks complexity cyclomatic on your classes, the lower the score t ``` +## Average Class Method Cyclomatic Complexity is high + +This insight checks average class method cyclomatic complexity, the lower the score the easier your code is to understand. It raises an issue if complexity is over `5.0`. + +**Insight Class**: `NunoMaduro\PhpInsights\Domain\Insights\ClassMethodAverageCyclomaticComplexityIsHigh` + +
+ Configuration + +```php +\NunoMaduro\PhpInsights\Domain\Insights\ClassMethodAverageCyclomaticComplexityIsHigh::class => [ + 'maxClassMethodAverageComplexity' => 5.0, +] +``` +
+ +## Method Cyclomatic Complexity is high + +This insight checks cyclomatic complexity of your methods, the lower the score the easier your code is to understand. It raises an issue if complexity is over `5`. + +**Insight Class**: `NunoMaduro\PhpInsights\Domain\Insights\MethodCyclomaticComplexityIsHigh` + +
+ Configuration + +```php +\NunoMaduro\PhpInsights\Domain\Insights\MethodCyclomaticComplexityIsHigh::class => [ + 'maxMethodComplexity' => 5, +] +``` +
+