Skip to content

CXX Metrics

guwirth edited this page Mar 10, 2021 · 4 revisions

To evaluate the software, SonarQube calculates software metrics and displays them under Project > Measures. The cxx plugin supports besides the SonarQube standard metrics further CXX specific metrics, which are listed under Measures > CXX.

Measures > CXX Description
Public API Total number of publicly accessible Application Programming Interfaces (API). Files that are to be analyzed are defined via sonar.cxx.metric.api.file.suffixes.
Public Documented API (%) Percentage of documented publicly accessible Application Programming Interfaces (API).
Percentage = (Public API - Public Undocumented API) / Public API
Public Undocumented API Total number of undocumented publicly available Application Programming Interfaces (API). Files that are to be analyzed are defined via sonar.cxx.metric.api.file.suffixes.
Complex Functions Number of functions with high cyclomatic complexity. You can define the threshold with sonar.cxx.metric.func.complexity.threshold.
Complex Functions (%) Percentage of functions with high cyclomatic complexity.
Percentage = Complex Functions / Functions
Complex Functions Lines of Code Lines of code in functions with high cyclomatic complexity. You can define the threshold with sonar.cxx.metric.func.complexity.threshold.
Complex Functions Lines of Code (%) Percentage of lines of code in functions with high cyclomatic complexity.
Percentage = Complex Functions Lines of Code / Lines of Code in Functions
Big Functions Number of functions with too many lines of code. You can define the threshold with sonar.cxx.metric.func.size.threshold.
Big Functions (%) Percentage of functions with too many lines of codes.
Percentage = Big Functions / Functions
Big Functions Lines of Code Lines of code in big functions. You can define the threshold with sonar.cxx.metric.func.size.threshold.
Big Functions Lines of Code (%) Percentage of lines of code in big functions.
Percentage = Big Functions Lines of Code / Lines of Code in Functions
Lines of Code in Functions Total number of lines of code within function bodies.
Duplications For duplications (Copy Paste Detection) the cxx plugin has two more settings:
- sonar.cxx.metric.cpd.ignoreLiterals: Ignores literal (numbers, characters and strings) value differences when evaluating a duplicate block. This means that e.g. foo=42; and foo=43; will be seen as equivalent.
- sonar.cxx.metric.cpd.ignoreIdentifiers: Ignores identifier value differences when evaluating a duplicate block e.g. variable names, methods names, and so forth.
Clone this wiki locally