scitools.com

Solution: HIS Metrics

The Hersteller Initiative Software (HIS) metrics are a list of metrics and thresholds developed by the automotive industry to ensure code quality. The documentation for them available in English is at https://emenda.com/his/ ↗.

image

The HIS Metrics interactive report

In Understand, the primary way of accessing these metrics has been through running the CodeCheck configuration. There is now also an interactive report. The interactive report and metric plugins are described in a blog article ↗.

HIS Metrics

Name Acronym Understand Metric ID
Comment Density COMF RatioCommentsWithBeforeToCode
Number of paths PATH CountPath [1,2]
Number of Goto Statements GOTO CountGoTo
Cyclomatic Complexity v(G) Cyclomatic [1,2]
Number of Calling Functions CALLING CountCallbyUnique
Number of called functions CALLS CountCallsUnique
Number of Function Parameters PARAM CountParams
Number of Instructions per function STMT CountStmt [1]
Number of call Levels LEVEL MaxCallDepth
Number of return points RETURN CountEarlyExit [3]
The stability index S StabilityIndex [4]
Language scope VOCF LanguageScope
Number of MISRA HIS Subset violations NOMV HISNOMV [5]
Number of MISRA violations per rule NOMVPR [5,6]
Number of recursions ap_cg_cycle IsRecursive [7]
Statements changed SCHG CountLineChanged [1,4,8]
Statements deleted SDEL CountLineRemoved [1,4,8]
New statements SNew CountLineNew [1,4,8]

Notes:

  1. This metric is built-in to Understand
  2. Visible cyclomatic metrics are controlled in project settings
  3. The metric is only reporting early exits, not all exits, matching the corresponding CodeCheck check. So the expected value is one lower.
  4. All change metrics are line based instead of statement based. A comparison database must be set to calculate comparison metrics.
  5. This metric depends on the MISRA HIS configuration running in the background.
  6. This metric is not supported. Similar output is available by running the MISRA HIS configuration and generating a "Results By Check Report". The report will show the number of violations for each rule.
  7. This metric returns 0 for non-recursive functions, 1 for directly recursive functions, and 2 for indirectly recursive functions.
  8. These metrics are not listed on https://emenda.com/his/ ↗ but have been listed on https://www.imagix.com/user_guide/his-+-misra-c.html ↗

Hersteller Initiative Software (HIS) Plugins

Name Kind
Comment to Code Ratio (Includes Comments Before Functions) Metric
Early Exits Metric
Goto Statements Metric
Hersteller Initiative Software (HIS) Metrics CodeCheck Configuration
HIS Metrics Interactive Report
Language Scope (VOCF) Metric
Maximum Call Depth Metric
MISRA HIS Subset CodeCheck Configuration
MISRA HIS Subset Violations (NOMV) Metric
Parameters Metric
Recursive Metric
Stability Index Metric
Unique Called By Metric
Unique Calls Metric