QA-MISRA New

Code insights and reporting

QA-MISRA New

Code insights and reporting

Metrics & Visualizations

Code quality can be analysed through numeric metrics which are counts of elements within the source code. Code quality such as complexity and interrelationships can also be visualised with interactive graphs and diagrams.

This section lists the code metrics that can be computed by QA-MISRA together with rules for checking thresholds for these metrics. A basic set of code metrics is defined by the Hersteller initiative Software (HIS). The following sections do specify for the supported metrics whether and under what name the respective metric is part of this set of code metrics.

HIS (Herstel lerinitiative Software – Manufacturer’s software initiative) is a cooperation of the automotive industry associations of Germany, UK and France. Its aim is to create an internationally valid common infrastructure for software quality assurance in the automotive industry. Software metrics are the basis for efficient project and quality management. With software Metrics, statements can be made about the quality of the software product and the software development process. In this document HIS specifies a fundamental set of metrics to be used in the evaluation of software.

Hersteller Initiative Software (HIS) Metrics

The following HIS Metrics are supported by QAMISRA with threshold checks:

  • COMF (comment density)
  • PATH (number of paths)
  • GOTO (number of jump statements)
  • v(G) (cyclomatic complexity)
  • CALLING (number of callers)
  • CALLS (number of callees)
  • PARAM (number of arguments)
  • STMT (statements per function)
  • LEVEL (call levels)
  • RETURN (number of returns)
  • VOCF Language Scope
  • ap_cg_cycle number of recursive path

And the following HIS Metrics are supported by QA-MISRA without threshold checks:

  • NOMV This metric counts the number of violations of the HIS Subset MISRA C 1.0.2.
    The number of rule violations of supported and activated MISRA rules is shown by QA-MISRA.
  • NOMVPR This metric counts the number of violations of the HIS Subset MISRA C 1.0.2. per rule.
    The number of rule violations of per supported and activated MISRA rules is shown by QA-MISRA

Code Quality Metrics

In addition to the HIS metrics, QA-MISRA computes the following code quality metrics distinguished over 4 levels:

Statement
The metric applies to a single statement. Metrics on statement level are only available for threshold checks and not directly reported. On this level, the following metric is computed:

  • Size of statement

Function
The metric applies to a single function. On this level, the following metrics are computed:

  • Comment density (HIS)
  • Cyclomatic complexity
  • Number of return statements
  • Number of go to statements
  • Number of instructions
  • Number of parameters
  • Number of maintainable code lines
  • Maximum nesting of control structures
  • Number of execution paths
  • Number of called functions
  • Number of calling functions
  • Language scope
  • Number of local variables

File
The metric applies to a single file. On this level, the following metrics are computed:

  • Comment density
  • Number of source lines
  • Number of physical source lines
  • Number of function definitions

Application
The metric computes one value over all files of the analysis project. On this level, the following metrics are computed:

  • Number of recursive paths
  • Number of original source files
  • Number offunction definitions
  • Number of source lines
  • Number of physical source lines

Code Visualisation

The QA-MISRA Call Graphs are a visual representation of direct calls (into and out of) functions / methods.

These call graphs present contextual rule findings, source code links and CSV exports provide graphical insights into code quality.

C++ classes visualization

A class graph visualizes a selected class together with its relations to others. Possible relations are inheritance, template instantiation/specialization, and usage as type of field members. For each individual class, detailed information on the respective field and method members can be inspected.The QA-MISRA Call Graphs are a visual representation of direct calls (into and out of) functions / methods.

These call graphs present contextual rule findings, source code links and CSV exports provide graphical insights into code quality.