We are scanning Cobol sources.
When we have a 01-level field with an 88-level condition, followed by a 78-level constant definition,
we get 2 code-smell warnings about ‘fields with the same level not being aligned’.
Moving the 78-level constant definition up in the source, so that it comes before the 01-level field makes the code-smells go away.
We believe that 66, 67, 78 and 88-level definitions should be exluded from this rule.
Versions used:
Cobol: AcuCobol version 10.2.1, fixed format
SonarQube: Enterprise Edition Version 9.6.1 (build 59531)
Source code example:
IDENTIFICATION DIVISION.
PROGRAM-ID. PP0041.
WORKING-STORAGE SECTION.
01 FIELD-1-LEVEL-01 PIC X(01).
88 FIELD-1-CONDITION-NAME VALUE "Y" FALSE "N".
78 CONSTANT-78-LEVEL VALUE "Constant".
PROCEDURE DIVISION.
IF FIELD-1-CONDITION-NAME
DISPLAY CONSTANT-78-LEVEL
END-IF
GOBACK
.