Metrics

Required role  Rule Management
Access  CodeChecker Server Rules Configuration →  Metrics

Metrics are numeric values deduced from the analysis of an application's source code. These values are used in quality rules to help determine code quality.

Metrics are based on metric models. A metric model is a script that defines the actions to carry out and their required properties. The metric created from a metric model must be instantiated to be used in a quality rule: this means values for each of the model's properties are defined to conform to the specific quality rule’s context.

The same metric can be used in multiple quality rules, depending on the validation expression defined in each quality rule.

Example

You want to create a quality rule to make sure the word 'TODO' is not found in the source code or the comments. The metric used in the quality rule needs to find the occurrences of this word.

To create the required metric, you will need to use the SEARCH_WORD metric model. When you instantiate the metric, you will define the following properties:

  • for Word, select TODO,
  • for Case sensitive, select false,
  • for Search type, select CONTAINS,
  • for Include comments, select true.

The metric will be incremented by one every time the word 'TODO' is found in a source code or the comments during the execution of the quality rule.

Reference

For more information about metric models, refer to Metric models.

For more information about quality rules, refer to Quality rules.

Metrics

The  Metrics view is accessed from the  Rules Configuration node in the Navigator.

Enter any combination of the above search criteria, then click the Search button to display the results. To display the complete list, click the Search button without entering any search criteria.