rspec/rules/S1730/rule.adoc
2022-02-04 16:28:24 +00:00

52 lines
1.4 KiB
Plaintext

Shared coding conventions allow teams to collaborate efficiently, and consistently indented code has a strong impact on readability. This rule checks that the following spacing conventions are followed:
* 01 level declaration should start in a specific column (8 by default)
* Subordinate data items must be indented from superior data items.
* In a file, all data item declarations having the same level should start in the same column
== Noncompliant Code Example
[source,text]
----
01 StudentDetails.
05 StudentId PIC 9(7). *< Noncompliant: indented too far
05 StudentName.
07 FirstName PIC X(10).
07 MiddleInitial PIC X. *< Noncompliant
07 Surname PIC X(15).
05 DateOfBirth.
07 DayOfBirth PIC 99.
07 MonthOfBirth PIC 99.
07 YearOfBirth PIC 9(4). *< Noncomopliant
09 CourseCode PIC X(4). *< Noncompliant: not indented enough
----
== Compliant Solution
[source,text]
----
01 StudentDetails.
05 StudentId PIC 9(7).
05 StudentName.
07 FirstName PIC X(10).
07 MiddleInitial PIC X.
07 Surname PIC X(15).
05 DateOfBirth.
07 DayOfBirth PIC 99.
07 MonthOfBirth PIC 99.
07 YearOfBirth PIC 9(4).
09 CourseCode PIC X(4).
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]