Here is the list of metrics computed by the Sonar Cobol Product with their descriptions :
| Metric | Description |
|---|---|
| Lines | Physical lines = number of carriage returns |
| Generated lines | Number of physical lines generated by COBOL code generators like CA-Telon |
| Lines of code | Number of actual lines of code = number of physical lines – number of blank lines – number of comment lines – number of blank comments – number of generated lines – number of pre-processing instructions |
| Pre-processing instructions | The following instructions are pre-processing : SKIP1, SKIP2, SKIP3, COPY, EJECT, REPLACE |
| Generated lines of code | Number of actual lines of generated code = number of physical generated lines + number of blank not generated lines |
| Files | Number of files that have been analyzed |
| Paragraphs | Number of paragraphs defined in the programs |
| Directories | Number of physical directories containing files |
| Comment lines | Number of true comment lines, i.e. comments that are not generated and that are not blank comments. It is to be noted that lines that contain the following instructions are counted both as comments and lines of code : AUTHOR, INSTALLATION, DATE-COMPILED, DATE-WRITTEN, SECURITY |
| Comments density | Number of comment lines / (non commenting lines of code + number of comments lines) * 100 |
| Blank Comments | Comment that are empty or only contain charcacters used to format the program : *——— or *========== for example |
| Total API | Number of paragraphs except the paragraphs that contain only an EXIT statement |
| Undocumented API | Number of API that are not commented |
| Density of public documented API | (Number of public API – Number of undocumented public API) / Number of public API * 100 |
| Duplicated lines | Number of physical lines touched by a duplication |
| Duplicated blocks | Number of duplicated blocks of lines |
| Duplicated files | Number of files involved in a duplication of lines |
| Density of duplicated lines | Duplicated lines / Physical lines * 100 |
| Statements | Number of Cobol statements : move, if, accept, add, alter, call, cancel, close, compute, continue, delete, display, divide, entry, evaluate, exitProgram, goback, goto, initialize, inspect, merge, multiply, open, perform, read, release, return, rewrite, search, set, sort, start, stop, string, subtract, unstring, write, exec, ibmXmlParse , ibmXmlGenerate , readyReset , mfCommit , mfRollback |
| Complexity | The Cyclomatic Complexity Number is also know as McCabe Metric. The Cyclomatic counter gets incremented by one for each paragraph and each time the control flow splits. The following commands increase the complexity by one : ALSO, ALTER, AND, DEPENDING, END_OF_PAGE, ENTRY, EOP, EXCEPTION, EXIT, GOBACK, CONTINUE, IF, INVALID, OR, OVERFLOW, SIZE, STOP, TIMES, UNTIL, USE, VARYING, WHEN, EXEC CICS HANDLE, EXEC CICS LINK, EXEC CICS XCTL and EXEC CICS RETURN |
| Complexity / paragraph | Average cyclomatic complexity by paragraph |
| Complexity / file | Average cyclomatic complexity by file |
| Violations | Total number of rule violations |
| Rules Compliance Index | 100 – (weighted_violations / Lines of code * 100) |
| Lines of code in data divisions | The number of not generated lines of code in data divisions |
| Lines of code in procedure divisions | The number of not generated lines of code in procedure divisions |
| Outside control flow statements | Number of outside (inter programs) control flow statements (CALL, EXEC CICS LINK, EXEC CICS XCTL, EXEC SQL, EXEC CICS RETURN) |
| Inside control flow statements | Number of inside (intra program) control flow statements (GOBACK, STOP RUN, DISPLAY, CONTINUE, EXIT, RETURN, PERFORM paragraph1 THRU paragraph2) |
| Comments in procedure divisions | The number of comment lines inside procedure divisions |

