Main Content

Coding Standards and Code Metrics

MISRA, AUTOSAR, CERT, and JSF coding rule sets, custom coding rules, code metrics

To specify which coding standards you want to check, for instance, MISRA C™:2012 or AUTOSAR C++14, use the coding standard options. To see code complexity metrics in your analysis results, for instance, cyclomatic complexity and number of calling or called functions, use the code metrics option.

Analysis Options

expand all

Check MISRA C:2004 (-misra2)Check for violation of MISRA C:2004 rules
Check MISRA AC AGC (-misra-ac-agc)Check for violation of MISRA AC AGC rules
Check MISRA C:2012 (-misra3)Check for violations of MISRA C:2012 rules and directives
Use generated code requirements (-misra3-agc-mode)Check for violations of MISRA C:2012 rules and directives that apply to generated code
Check MISRA C:2023 (-misra-c-2023)Check for violations of MISRA C:2023 rules and directives (Since R2024a)
Use generated code requirements (-misra-c-2023-agc-mode)Check for violations of MISRA C:2023 rules and directives that apply to generated code (Since R2024a)
Effective boolean types (-boolean-types)Specify data types that coding rule checker must treat as effectively Boolean
Check SEI CERT-C (-cert-c)Check for violations of CERT C rules and recommendations
Check ISO/IEC TS 17961 (-iso-17961)Check for violations of ISO/IEC TS 17961 rules
Check MISRA C++:2008 (-misra-cpp)Check for violations of MISRA C++ rules
Check JSF AV C++ (-jsf-coding-rules)Check for violations of JSF C++ rules
Check AUTOSAR C++14 (-autosar-cpp14)Check for violations of AUTOSAR C++ 14 rules
Check SEI CERT-C++ (-cert-cpp)Check for violations of CERT C++ rules
Set checkers by file (-checkers-selection-file)Define a custom set of coding standards checks for your analysis
Check CWE (-cwe)Check for weaknesses in your code that are enumerated in CWE (Since R2023a)
Check custom rules (-custom-rules)Follow naming conventions for identifiers
Check Guidelines (-guidelines)Check for violations of Guidelines (Since R2021a)
Allowed pragmas (-allowed-pragmas)Specify pragma directives that are documented
Calculate code metrics (-code-metrics)Compute and display code complexity metrics

Topics

Getting Started

MISRA or JSF Rules

Code Complexity Metrics

Related Information