14.1.3.1 Line Metrics Control
For any (legal) source file, and for each of its
eligible local program units, gnatmetric computes the following
metrics:
- the total number of lines;
- the total number of code lines (i.e., non-blank lines that are not comments)
- the number of comment lines
- the number of code lines containing end-of-line comments;
- the comment percentage: the ratio between the number of lines that contain
comments and the number of all non-blank lines, expressed as a percentage;
- the number of empty lines and lines containing only space characters and/or
format effectors (blank lines)
- the average number of code lines in subprogram bodies, task bodies, entry
bodies and statement sequences in package bodies (this metric is only computed
across the whole set of the analyzed units)
gnatmetric sums the values of the line metrics for all the
files being processed and then generates the cumulative results. The tool
also computes for all the files being processed the average number of code
lines in bodies.
You can use the following switches to select the specific line metrics
to be computed and reported.
- --lines-all
- Report all the line metrics
- --no-lines-all
- Do not report any of line metrics
- --lines
- Report the number of all lines
- --no-lines
- Do not report the number of all lines
- --lines-code
- Report the number of code lines
- --no-lines-code
- Do not report the number of code lines
- --lines-comment
- Report the number of comment lines
- --no-lines-comment
- Do not report the number of comment lines
- --lines-eol-comment
- Report the number of code lines containing
end-of-line comments
- --no-lines-eol-comment
- Do not report the number of code lines containing
end-of-line comments
- --lines-ratio
- Report the comment percentage in the program text
- --no-lines-ratio
- Do not report the comment percentage in the program text
- --lines-blank
- Report the number of blank lines
- --no-lines-blank
- Do not report the number of blank lines
- --lines-average
- Report the average number of code lines in subprogram bodies, task bodies,
entry bodies and statement sequences in package bodies. The metric is computed
and reported for the whole set of processed Ada sources only.
- --no-lines-average
- Do not report the average number of code lines in subprogram bodies,
task bodies, entry bodies and statement sequences in package bodies.