Standard metrics
A sample for dealing with the standard metrics is provided below.
In this sample "650" (= 650 bytes) is defined as upper limit for the metric "code size" and "5" as upper limit for the metric "number of input variables" (see: Configuration of the metrics). In addition, rule 150 (SA0150: Violation of lower or upper metrics limits) is enabled and configured as warning.
When the command 'View Standard Metrics' is issued, the metric view opens and the indicators that were determined are displayed in tabular form. Since the size of the MAIN program is 688 bytes and the program SampleProgram has 7 input variables, these indicators exceed the defined upper limit in each case, so that the corresponding table cells are shown in red.
In this sample, the fact that the defined upper limits are exceeded is not only apparent in the metric view. Since rule 150 is configured as warning, the static analysis checks for violations of lower and upper metric limits. After the static analysis has been performed, the violation of the two upper limits is therefore reported as a warning in the message window.