Skip to content

Commit 248a68b

Browse files
committed
one_construct_per_line: Add support for component clauses
1 parent 1a68d3f commit 248a68b

File tree

3 files changed

+40
-20
lines changed

3 files changed

+40
-20
lines changed

lkql_checker/share/lkql/one_construct_per_line.lkql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ fun one_construct_per_line(node) =
4040
Stmt
4141
| BasicDecl
4242
| AspectClause
43+
| ComponentClause
4344
| PragmaNode
4445
| WithClause
4546
| UseClause(p_matching_with_use_clause(): false)

testsuite/tests/checks/one_construct_per_line/line.adb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,17 @@ package body Line is
3030
end Start;
3131
end Other_Tsk;
3232

33+
type R is record
34+
A : Boolean;
35+
B : Boolean;
36+
C : Boolean;
37+
end record;
38+
39+
for R use record
40+
A at 1 range 1 .. 2; B at 2 range 2 .. 3; -- FLAG (2);
41+
C at 3 range 3 .. 4; -- NOFLAG
42+
end record;
43+
3344
procedure Proc (I : in out Integer) is
3445
Tmp : Integer;
3546

testsuite/tests/checks/one_construct_per_line/test.out

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -54,46 +54,54 @@ line.adb:29:50: rule violation: more than one construct on the same line
5454
29 | accept Start (I : Integer; B : Boolean) do null; -- FLAG
5555
| ^^^^^
5656

57-
line.adb:38:7: rule violation: more than one construct on the same line
58-
38 | B3 : Boolean; B4 : Boolean; -- FLAG (2)
57+
line.adb:40:7: rule violation: more than one construct on the same line
58+
40 | A at 1 range 1 .. 2; B at 2 range 2 .. 3; -- FLAG (2);
59+
| ^^^^^^^^^^^^^^^^^^^^
60+
61+
line.adb:40:28: rule violation: more than one construct on the same line
62+
40 | A at 1 range 1 .. 2; B at 2 range 2 .. 3; -- FLAG (2);
63+
| ^^^^^^^^^^^^^^^^^^^^
64+
65+
line.adb:49:7: rule violation: more than one construct on the same line
66+
49 | B3 : Boolean; B4 : Boolean; -- FLAG (2)
5967
| ^^
6068

61-
line.adb:38:21: rule violation: more than one construct on the same line
62-
38 | B3 : Boolean; B4 : Boolean; -- FLAG (2)
69+
line.adb:49:21: rule violation: more than one construct on the same line
70+
49 | B3 : Boolean; B4 : Boolean; -- FLAG (2)
6371
| ^^
6472

65-
line.adb:42:10: rule violation: more than one construct on the same line
66-
42 | I := J; if I > 0 then -- FLAG (2)
73+
line.adb:53:10: rule violation: more than one construct on the same line
74+
53 | I := J; if I > 0 then -- FLAG (2)
6775
| ^^^^^^^
6876

69-
line.adb:42:18: rule violation: more than one construct on the same line
70-
42 | I := J; if I > 0 then -- FLAG (2)
77+
line.adb:53:18: rule violation: more than one construct on the same line
78+
53 | I := J; if I > 0 then -- FLAG (2)
7179
| __________________^
72-
43 || I := 0; end if; -- FLAG
80+
54 || I := 0; end if; -- FLAG
7381
||__________________________^
7482

75-
line.adb:43:12: rule violation: more than one construct on the same line
76-
43 | I := 0; end if; -- FLAG
83+
line.adb:54:12: rule violation: more than one construct on the same line
84+
54 | I := 0; end if; -- FLAG
7785
| ^^^^^^^
7886

79-
line.adb:56:18: rule violation: more than one construct on the same line
80-
56 | My_Loop_2: for I in 1 .. 2 loop -- FLAG
87+
line.adb:67:18: rule violation: more than one construct on the same line
88+
67 | My_Loop_2: for I in 1 .. 2 loop -- FLAG
8189
| __________________^
8290
||
8391
|| ~~~ 1 other lines ~~~
8492
||
85-
58 || end loop My_Loop_2;
93+
69 || end loop My_Loop_2;
8694
||_________________________^
8795

88-
line.adb:60:7: rule violation: more than one construct on the same line
89-
60 | Tmp := I; I := I + 1; -- FLAG (2)
96+
line.adb:71:7: rule violation: more than one construct on the same line
97+
71 | Tmp := I; I := I + 1; -- FLAG (2)
9098
| ^^^^^^^^^
9199

92-
line.adb:60:17: rule violation: more than one construct on the same line
93-
60 | Tmp := I; I := I + 1; -- FLAG (2)
100+
line.adb:71:17: rule violation: more than one construct on the same line
101+
71 | Tmp := I; I := I + 1; -- FLAG (2)
94102
| ^^^^^^^^^^^
95103

96-
line.adb:62:7: rule violation: more than one construct on the same line
97-
62 | I := I + 1; end Proc; -- FLAG
104+
line.adb:73:7: rule violation: more than one construct on the same line
105+
73 | I := I + 1; end Proc; -- FLAG
98106
| ^^^^^^^^^^^
99107

0 commit comments

Comments
 (0)