Why do I get a cyclometric complexity of 2 for a switch block?
2 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2020 年 8 月 7 日
回答済み: MathWorks Support Team
2020 年 8 月 7 日
I am running the "Cyclomatic complexity metric" check for a model which contains a switch block. Why do I get a Cyclometric complexity of 2?
My switch block has 1 decision point and 2 outcomes so the cyclometric complexity should be 1, but I am getting a complexity of 2. Please provide the reasoning behind this.
採用された回答
MathWorks Support Team
2020 年 8 月 7 日
As per the formula in the following documentation the cyclometric complexity for the block is computed individually as 1:
The formula is applied to every block in the model, so switch block gets a cyclometric complexity of 1 and default path in the model without the switch block adds another 1 for a total complexity of 2.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Verification, Validation, and Test についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!