[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Metrics-Related Rules

The rules in this chapter can be used to enforce compliance with specific code metrics, by checking that the metrics computed for a program lie within user-specifiable bounds. Depending on the metric, there may be a lower bound, an upper bound, or both. A construct is flagged if the value of the metric exceeds the upper bound or is less than the lower bound.

3.1 Metrics_Essential_Complexity  
3.2 Metrics_Cyclomatic_Complexity  
3.3 Metrics_LSLOC  

The name of any metrics rule consists of the prefix Metrics_ followed by the name of the corresponding metric: Essential_Complexity, Cyclomatic_Complexity, or LSLOC. (The "LSLOC" acronym stands for "Logical Source Lines Of Code".) The meaning and the computed values of the metrics are the same as in gnatmetric.

For the `+R' option, each metrics rule has a numeric parameter specifying the bound (integer or real, depending on a metric). The `-R' option for the metrics rules does not have a parameter.

Example: the rule
 
+RMetrics_Cyclomatic_Complexity : 7
means that all bodies with cyclomatic complexity exceeding 7 will be flagged.

To turn OFF the check for cyclomatic complexity metric, use the following option:
 
-RMetrics_Cyclomatic_Complexity


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Metrics_Essential_Complexity

The Metrics_Essential_Complexity rule takes a positive integer as upper bound. A construct exceeding this limit will be flagged.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Metrics_Cyclomatic_Complexity

The Metrics_Cyclomatic_Complexity rule takes a positive integer as upper bound. A construct exceeding this limit will be flagged.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3 Metrics_LSLOC

The Metrics_LSLOC rule takes a positive integer as upper bound. A compilation unit exceeding this limit will be flagged.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Mail Server on June, 3 2010 using texi2html