File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed
testsuite/tests/checks/metrics_cyclomatic Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ fun statement_complexity(body, exempt_case=false) =
3939 | e@ExitStmt(f_cond_expr: not null) => 1
4040 | s@SelectStmt(
4141 f_guards: guards,
42- f_else_stmts : elses_stmts,
42+ f_else_part : elses_stmts,
4343 f_then_abort_part: then_abort_part
4444 ) => guards.children_count
4545 + (if elses_stmts.children_count == 0 then 0 else 1)
Original file line number Diff line number Diff line change @@ -36,11 +36,33 @@ procedure Proc (I : in out Integer; S : String) is -- FLAG Complexity 7
3636 when 2 => null ;
3737 when 3 => null ;
3838 when 4 => null ;
39- when others => I := if I > 0 then 1 elsif False then 2 else 3 ;
39+ when others => I := ( if I > 0 then 1 elsif False then 2 else 3 ) ;
4040 end case ;
4141 end E1 ;
4242 end Prot ;
4343
44+ task U is
45+ entry E1;
46+ entry E2;
47+ entry E3;
48+ entry E4;
49+ end U ;
50+
51+ task body U is -- FLAG Complexity 6
52+ begin
53+ select
54+ accept E1;
55+ or
56+ accept E2;
57+ or
58+ accept E3;
59+ or
60+ accept E4;
61+ or
62+ terminate ;
63+ end select ;
64+ end U ;
65+
4466begin
4567 if I in 1 .. 10 then
4668 for J in S'Range loop
Original file line number Diff line number Diff line change @@ -2,9 +2,9 @@ proc.adb:1:1: rule violation: cyclomatic complexity is too high: 7
221 | procedure Proc (I : in out Integer; S : String) is -- FLAG Complexity 7
33 | _^
44 ||
5- || ~~~ 58 other lines ~~~
5+ || ~~~ 80 other lines ~~~
66 ||
7- 60 || end Proc;
7+ 82 || end Proc;
88 ||_________^
99
1010proc.adb:8:4: rule violation: cyclomatic complexity is too high: 6
@@ -34,3 +34,12 @@ proc.adb:32:7: rule violation: cyclomatic complexity is too high: 7
343441 || end E1;
3535 ||_____________^
3636
37+ proc.adb:51:4: rule violation: cyclomatic complexity is too high: 6
38+ 51 | task body U is -- FLAG Complexity 6
39+ | ____^
40+ ||
41+ || ~~~ 12 other lines ~~~
42+ ||
43+ 64 || end U;
44+ ||_________^
45+
You can’t perform that action at this time.
0 commit comments