How can I view the cyclomatic complexity values of functions that violate the cyclomatic complexity rule in Polyspace?

7 visualizzazioni (ultimi 30 giorni)

I have configured Polyspace Bug Finder to check for violations of the Cyclomatic Complexity rule from the HIS metrics.
The report only shows the file name and the number of violations, like:

foo -> 2 violations
but I would like the report to show the function name and the actual value of cyclomatic complexity of the function, like:

function1() -> 20

function2() -> 30
How can I achieve this?

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 12 Feb 2025
This can be achieved by selecting Check Code Metrics in the configuration of your project.
It can be found under "Coding Standards & Code Metrics -> Code Metrics".
This option includes a check of the cyclomatic complexity of the code, which is the same check as the HIS metric, but outputs the function name and the actual value of cyclomatic complexity of the function.
Visit the Code Metrics documentation page for more information.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by