@@ -99,7 +99,7 @@ package body Gnatcheck.Projects is
9999 (Self : Gnatcheck_Reporter) return GPR2.Reporter.Verbosity_Level;
100100
101101 Gpr2_Reporter : Gnatcheck_Reporter;
102- -- Make libgpt2 report messages using the proper gnatcheck .Output API
102+ -- Make libgpr2 report messages using the proper ``Gnatcheck .Output`` API.
103103
104104 function Report_Missing_File (Log : String) return Boolean
105105 is (Index (Log, " source file" ) /= 0 and then Index (Log, " not found" ) /= 0 );
@@ -1056,7 +1056,7 @@ package body Gnatcheck.Projects is
10561056 -- Process_Rule_Options --
10571057 -- ------------------------
10581058
1059- type Option_Kind is (File, Option );
1059+ type Option_Kind is (File, Legacy_Option, Single_Rule_Name );
10601060
10611061 type Option_Record is record
10621062 Kind : Option_Kind;
@@ -1080,43 +1080,53 @@ package body Gnatcheck.Projects is
10801080 for O of Rule_Options loop
10811081 case O.Kind is
10821082 when File =>
1083- Process_Rule_File (To_String (O.Value));
1083+ Process_Legacy_Rule_File (To_String (O.Value));
10841084
1085- when Option =>
1086- Process_Rule_Option (To_String (O.Value), Defined_At => " " );
1085+ when Legacy_Option =>
1086+ Process_Legacy_Rule_Option
1087+ (To_String (O.Value), Defined_At => " " );
1088+
1089+ when Single_Rule_Name =>
1090+ Process_Single_Rule_Name (To_String (O.Value));
10871091 end case ;
10881092 end loop ;
10891093 Process_Compiler_Instances;
10901094 end Process_Rule_Options ;
10911095
1092- -- -------------------
1093- -- Add_Rule_Option --
1094- -- -------------------
1096+ -- --------------------------
1097+ -- Add_Legacy_Rule_Option --
1098+ -- --------------------------
10951099
1096- procedure Add_Rule_Option (Opt : String; Prepend : Boolean := False) is
1100+ procedure Add_Legacy_Rule_Option (Opt : String; Prepend : Boolean := False)
1101+ is
10971102 use Ada.Strings.Unbounded;
10981103
10991104 Opt_Rec : constant Option_Record :=
1100- (Option , To_Unbounded_String (Trim (Opt, Both)));
1105+ (Legacy_Option , To_Unbounded_String (Trim (Opt, Both)));
11011106 begin
11021107 if Prepend then
11031108 Rule_Options.Prepend (Opt_Rec);
11041109 else
11051110 Rule_Options.Append (Opt_Rec);
11061111 end if ;
1107- end Add_Rule_Option ;
1112+ end Add_Legacy_Rule_Option ;
11081113
11091114 -- --------------------
11101115 -- Add_Rule_By_Name --
11111116 -- --------------------
11121117
11131118 procedure Add_Rule_By_Name (Rule_Name : String; Prepend : Boolean := False)
11141119 is
1115- Lower_Rule : constant String := To_Lower (Rule_Name);
1116- Prefix : constant String :=
1117- (if Lower_Rule = " all" then " +" else " +R" );
1120+ use Ada.Strings.Unbounded;
1121+
1122+ Opt_Rec : constant Option_Record :=
1123+ (Single_Rule_Name, To_Unbounded_String (Trim (Rule_Name, Both)));
11181124 begin
1119- Add_Rule_Option (Prefix & Lower_Rule, Prepend => Prepend);
1125+ if Prepend then
1126+ Rule_Options.Prepend (Opt_Rec);
1127+ else
1128+ Rule_Options.Append (Opt_Rec);
1129+ end if ;
11201130 end Add_Rule_By_Name ;
11211131
11221132 -- ----------------------
@@ -1225,16 +1235,16 @@ package body Gnatcheck.Projects is
12251235 (Option_Record'
12261236 (File,
12271237 To_Unbounded_String (Parameter (Parser => Parser))));
1228- if not More_Then_One_Rule_File_Set then
1229- Rule_File_Name :=
1238+ if not More_Than_One_Legacy_Rule_File_Set then
1239+ Legacy_Rule_File_Name :=
12301240 new String'(Parameter (Parser => Parser));
1231- More_Then_One_Rule_File_Set := True;
1241+ More_Than_One_Legacy_Rule_File_Set := True;
12321242 else
1233- Free (Rule_File_Name );
1243+ Free (Legacy_Rule_File_Name );
12341244 end if ;
12351245
12361246 when others =>
1237- Add_Rule_Option (Full_Switch (Parser => Parser));
1247+ Add_Legacy_Rule_Option (Full_Switch (Parser => Parser));
12381248 Individual_Rules_Set := True;
12391249 end case ;
12401250 if not Rules_Depreciation_Emitted then
0 commit comments