Check MATLAB Function metrics
Check ID:
mathworks.maab.himl_0003
Guideline:
Description
This check provides complexity and code metrics for MATLAB® Functions. The check additionally reports metric violations.
A results table provides links to MATLAB Functions that violate the complexity input parameters.
This check requires a Simulink® Check™ license.
Check Parameterization
This Model Advisor check is not applicable for JMAAB modeling guidelines.
This check does not include sub-checks
For reference, the MAB guideline sub ID(s) that are recommended for use by the NA-MAAB and JMAAB modeling standards organizations are:
NA-MAAB — a
JMAAB — Not supported
To specify the complexity thresholds, use the Model Advisor Configuration Editor.
Open the Model Configuration Editor and search for check ID
himl_0003.Under Input Parameters, select Check .m files referenced in the model to include files with a
.mextension in the analysis.Define these complexity metrics:
Maximum effective lines of code per function — Provide the maximum effective lines of code per function. Effective lines do not include empty lines, comment lines, or lines with a function
endkeyword.Minimum density of comments — Provide minimum density of comments. Density is ratio of comment lines to total lines of code.
Maximum cyclomatic complexity per function — Provide maximum cyclomatic complexity per function. Cyclomatic complexity is the number of linearly independent paths through the source code.
Click Apply and save the configuration.
Results and Recommended Actions
| Condition | Recommended Action |
|---|---|
| MATLAB Function violates the complexity input parameters. | For the MATLAB Function:
|
Capabilities and Limitations
Runs on library models.
Does not analyze content of library linked blocks.
Analyzes content in all masked subsystems.
Allows exclusions of blocks and charts.