File tree Expand file tree Collapse file tree 6 files changed +61
-3
lines changed
testsuite/tests/gnatcheck/rules_dir Expand file tree Collapse file tree 6 files changed +61
-3
lines changed Original file line number Diff line number Diff line change 3
3
-- SPDX-License-Identifier: GPL-3.0-or-later
4
4
--
5
5
6
+ with Ada.Containers.Ordered_Sets ;
6
7
with Ada.Environment_Variables ;
7
8
8
9
with GNAT.OS_Lib ;
@@ -35,9 +36,12 @@ package body Rules_Factory is
35
36
(Ctx : L.Analysis_Context; Dirs : Path_Array := No_Paths)
36
37
return Rule_Vector
37
38
is
39
+ package Virtual_File_Sets is new
40
+ Ada.Containers.Ordered_Sets (Element_Type => Virtual_File);
41
+
38
42
Rules_Dirs : constant Virtual_File_Array := Get_Rules_Directories (Dirs);
39
43
Rules : Rule_Vector := Rule_Vectors.Empty_Vector;
40
- Seen : String_Sets .Set := String_Sets .Empty_Set;
44
+ Seen : Virtual_File_Sets .Set := Virtual_File_Sets .Empty_Set;
41
45
Impacts : constant JSON_Value := Get_Impacts (Rules_Dirs);
42
46
43
47
begin
@@ -53,7 +57,7 @@ package body Rules_Factory is
53
57
begin
54
58
for File of Dir.all loop
55
59
if File.File_Extension = +" .lkql"
56
- and then not Seen.Contains (+ File.Full_Name )
60
+ and then not Seen.Contains (File)
57
61
then
58
62
declare
59
63
Rc : Rule_Command;
@@ -64,7 +68,7 @@ package body Rules_Factory is
64
68
begin
65
69
if Has_Rule then
66
70
Rules.Append (Rc);
67
- Seen.Include (+ File.Full_Name );
71
+ Seen.Include (File);
68
72
end if ;
69
73
end ;
70
74
end if ;
Original file line number Diff line number Diff line change
1
+ project Prj is
2
+ end Prj;
Original file line number Diff line number Diff line change
1
+ @check(help="help", message="message")
2
+ fun my_rule(node) =
3
+ node is DefiningName
Original file line number Diff line number Diff line change
1
+ procedure Test is -- FLAG
2
+ begin
3
+ null ;
4
+ end ;
Original file line number Diff line number Diff line change
1
+ 1. Summary
2
+
3
+ fully compliant sources : 0
4
+ sources with exempted violations only : 0
5
+ sources with non-exempted violations : 1
6
+ unverified sources : 0
7
+ total sources : 1
8
+ ignored sources : 0
9
+
10
+ non-exempted violations : 1
11
+ rule exemption warnings : 0
12
+ compilation errors : 0
13
+ exempted violations : 0
14
+ internal errors : 0
15
+
16
+ 2. Exempted Coding Standard Violations
17
+
18
+ no exempted violations detected
19
+
20
+ 3. Non-exempted Coding Standard Violations
21
+
22
+ test.adb:1:11: rule violation: message
23
+
24
+ 4. Rule exemption problems
25
+
26
+ no rule exemption problems detected
27
+
28
+ 5. Language violations
29
+
30
+ no language violations detected
31
+
32
+ 6. Gnatcheck internal errors
33
+
34
+ no internal error detected
35
+
Original file line number Diff line number Diff line change
1
+ description : |
2
+ Ensure GNATCheck can handle several times the same rule directory and properly
3
+ builds a set of unique rules.
4
+ driver : gnatcheck
5
+ project : prj.gpr
6
+ rules_dirs :
7
+ - rules
8
+ - ./rules/../rules
9
+ rules :
10
+ - +Rmy_rule
You can’t perform that action at this time.
0 commit comments