diff --git a/alire_common.gpr b/alire_common.gpr index e479c0c38..39dabb983 100644 --- a/alire_common.gpr +++ b/alire_common.gpr @@ -23,14 +23,30 @@ abstract project Alire_Common is Style_Check_Switches := (); case Style_Check_Mode is when "enabled" => Style_Check_Switches := - ("-gnatwe", -- Warnings as errors - "-gnatyd", -- no DOS line terminators - "-gnatyI", -- no IN mode - "-gnatyO", -- all overrides - "-gnatyS", -- separate lines after THEN/ELSE - "-gnatyu", -- no unnecessary blank lines - "-gnatyx", -- no extra parens around conditionals - "-gnaty-s"); -- relax fwd decl + ( "-gnatwe" -- Warnings as errors + ,"-gnaty3" -- Specify indentation level of 3 + ,"-gnatya" -- Check attribute casing + ,"-gnatyA" -- Use of array index numbers in array attributes + ,"-gnatyB" -- Check Boolean operators + ,"-gnatyb" -- Blanks not allowed at statement end + ,"-gnatyc" -- Check comments + ,"-gnatye" -- Check end/exit labels + ,"-gnatyf" -- No form feeds or vertical tabs + ,"-gnatyh" -- No horizontal tabs + ,"-gnatyi" -- Check if-then layout + ,"-gnatyI" -- check mode IN keywords + ,"-gnatyk" -- Check keyword casing + ,"-gnatyl" -- Check layout + ,"-gnatym" -- Check maximum line length + ,"-gnatyn" -- Check casing of entities in Standard + ,"-gnatyO" -- Check all overriding subprograms explicitly marked + ,"-gnatyp" -- Check pragma casing + ,"-gnatyr" -- Check identifier references casing + ,"-gnatyS" -- Check no statements after THEN/ELSE + ,"-gnatyt" -- Check token spacing + ,"-gnatyu" -- Check unnecessary blank lines + ,"-gnatyx" -- Check extra parentheses + ); when "disabled" => Style_Check_Switches := (); end case; diff --git a/src/alire/alire-conditional.adb b/src/alire/alire-conditional.adb index 07847a011..c3eb6168a 100644 --- a/src/alire/alire-conditional.adb +++ b/src/alire/alire-conditional.adb @@ -60,8 +60,10 @@ package body Alire.Conditional is return Result : Boolean := True do for Child of T loop case T.Conjunction is - when Anded => Result := Result and Eval_Children (Child); - when Ored => Result := Result or Eval_Children (Child); + when Anded => + Result := Result and then Eval_Children (Child); + when Ored => + Result := Result or else Eval_Children (Child); end case; end loop; end return; diff --git a/src/alire/alire-config.ads b/src/alire/alire-config.ads index 496c229cf..5082ea522 100644 --- a/src/alire/alire-config.ads +++ b/src/alire/alire-config.ads @@ -70,7 +70,7 @@ package Alire.Config is Public : Boolean := True; Check : CLIC.Config.Check_Import := null) return Builtin_Option - with Pre => Help /= "" or not Public; + with Pre => Help /= "" or else not Public; function New_Builtin (Key : CLIC.Config.Config_Key; Def : Boolean; @@ -78,7 +78,7 @@ package Alire.Config is Public : Boolean := True; Check : CLIC.Config.Check_Import := null) return Builtin_Option - with Pre => Help /= "" or not Public; + with Pre => Help /= "" or else not Public; private diff --git a/src/alire/alire-errors.adb b/src/alire/alire-errors.adb index 4cf4adde9..00b34e8d1 100644 --- a/src/alire/alire-errors.adb +++ b/src/alire/alire-errors.adb @@ -131,9 +131,9 @@ package body Alire.Errors is if Line /= "" then Trace.Error ((if I > Lines.First_Index then " " else "") - -- Indentation + -- Indentation - & (if I < Lines.Last_Index and Line (Line'Last) = '.' + & (if I < Lines.Last_Index and then Line (Line'Last) = '.' then Line (Line'First .. Line'Last - 1) else Line) -- The error proper, trimming unwanted final '.' diff --git a/src/alire/alire-index_on_disk-git.ads b/src/alire/alire-index_on_disk-git.ads index d1562307f..3e1bff4c4 100644 --- a/src/alire/alire-index_on_disk-git.ads +++ b/src/alire/alire-index_on_disk-git.ads @@ -8,7 +8,7 @@ package Alire.Index_On_Disk.Git is function New_Handler (Origin : URL; Name : Restricted_Name; Parent : Any_Path) return Index with - Pre => AAA.Strings.Has_Prefix (Origin, "git+") or + Pre => AAA.Strings.Has_Prefix (Origin, "git+") or else AAA.Strings.Has_Prefix (Origin, "git@"); overriding diff --git a/src/alire/alire-index_on_disk.adb b/src/alire/alire-index_on_disk.adb index 7f74ecbd1..4d6258d38 100644 --- a/src/alire/alire-index_on_disk.adb +++ b/src/alire/alire-index_on_disk.adb @@ -99,8 +99,7 @@ package body Alire.Index_On_Disk is return Outcome_Success; exception when E : others => - return Outcome_From_Exception - (E, "Could not delete index directory: " & This.Metadata_Directory); + return Outcome_From_Exception (E, "Could not delete index directory"); end Delete; ---------- @@ -219,7 +218,7 @@ package body Alire.Index_On_Disk is (Origin (Origin'First + File_Prefix'Length .. Origin'Last)); elsif Origin (Origin'First) = '/' or else not (AAA.Strings.Contains (Origin, "@") - or AAA.Strings.Contains (Origin, "+")) + or else AAA.Strings.Contains (Origin, "+")) then return Process_Local_Index (Origin); end if; diff --git a/src/alire/alire-index_on_disk.ads b/src/alire/alire-index_on_disk.ads index 7d273dbd1..061c48778 100644 --- a/src/alire/alire-index_on_disk.ads +++ b/src/alire/alire-index_on_disk.ads @@ -37,7 +37,7 @@ package Alire.Index_On_Disk is Result : out Outcome; Priority : Priorities := Default_Priority) return Index'Class - with Post => Name in Restricted_Name or not Result.Success; + with Post => Name in Restricted_Name or else not Result.Success; pragma Warnings (On); -- Factory function. -- Name is a user given name used to denote the index (like a git origin). diff --git a/src/alire/alire-publish.adb b/src/alire/alire-publish.adb index 7933986d4..0a0d9ee82 100644 --- a/src/alire/alire-publish.adb +++ b/src/alire/alire-publish.adb @@ -562,7 +562,8 @@ package body Alire.Publish is -- Safeguard to avoid tests creating a live pull request, unless -- explicitly desired if OS_Lib.Getenv (Environment.Testsuite, "unset") /= "unset" - and then OS_Lib.Getenv (Environment.Testsuite_Allow, "unset") = "unset" + and then + OS_Lib.Getenv (Environment.Testsuite_Allow, "unset") = "unset" then raise Program_Error with "Attempting to go online to create a PR during tests"; @@ -631,9 +632,9 @@ package body Alire.Publish is Git : constant VCSs.Git.VCS := VCSs.Git.Handler; Is_Repo : constant Boolean := Git.Is_Repository (Base_Path (Context)); Archive : constant Relative_Path := Target_Dir / (Milestone & ".tgz"); - -- We used to use tbz2 for locally tar'ed files, but that has an implicit - -- dependency on bzip2 that we are not managing yet, so for now we err on - -- the safe side of built-in tar gzip capabilities. + -- We used to use tbz2 for locally tar'ed files, but that has an + -- implicit dependency on bzip2 that we are not managing yet, so for + -- now we err on the safe side of built-in tar gzip capabilities. ----------------- -- Git_Archive -- @@ -1111,7 +1112,7 @@ package body Alire.Publish is -- already. No matter what, it will be checked again on the -- deployed sources step. - if Revision = "" or Revision = "HEAD" then + if Revision = "" or else Revision = "HEAD" then declare Tmp_Context : Data := (Options => Options, others => <>); begin diff --git a/src/alire/alire-roots.adb b/src/alire/alire-roots.adb index 82c0dc919..3660b35c8 100644 --- a/src/alire/alire-roots.adb +++ b/src/alire/alire-roots.adb @@ -38,7 +38,7 @@ package body Alire.Roots is function Stop_Build (Wanted, Actual : Builds.Stop_Points) return Boolean is - use type Builds.Stop_Points; + use type Builds.Stop_Points; begin if Wanted <= Actual then Trace.Debug ("Stopping build as requested at stage: " & Wanted'Image); @@ -269,7 +269,7 @@ package body Alire.Roots is begin This.Build_Prepare (Saved_Profiles => Saved_Profiles, Force_Regen => False, - Stop_After => stop_after); + Stop_After => Stop_After); if Stop_Build (Stop_After, Actual => Generation) then return True; @@ -443,7 +443,7 @@ package body Alire.Roots is Prefix => Prefix, Recursive => False, Quiet => True, - Force => (Force or + Force => (Force or else Action in Reinstall | Replace)); -- Say something if after installing a crate it diff --git a/src/alire/alire-solutions-diffs.adb b/src/alire/alire-solutions-diffs.adb index 49289e28e..f64ddbc4f 100644 --- a/src/alire/alire-solutions-diffs.adb +++ b/src/alire/alire-solutions-diffs.adb @@ -235,7 +235,7 @@ package body Alire.Solutions.Diffs is if Has_Latter and then Latter.Is_Provided and then (not Has_Former or else - (Former.Has_Release and Then + (Former.Has_Release and then Former.Release.Name_Str /= Latter.Release.Name_Str)) then Add_Change (Chg, "", TTY.Italic (Latter.Release.Name.As_String)); diff --git a/src/alire/alire-solutions.ads b/src/alire/alire-solutions.ads index a6a946aaf..42e4e1efe 100644 --- a/src/alire/alire-solutions.ads +++ b/src/alire/alire-solutions.ads @@ -295,7 +295,7 @@ package Alire.Solutions is -- exact versions. NOTE that the original dependency is thus lost in this -- info. - function Pins (This : Solution) return dependency_Map; + function Pins (This : Solution) return Dependency_Map; -- return all version-pinned dependencies as plain dependencies for a exact -- version. NOTE that the original dependency is thus lost. diff --git a/src/alire/alire-solver.adb b/src/alire/alire-solver.adb index c82392ca3..59b732708 100644 --- a/src/alire/alire-solver.adb +++ b/src/alire/alire-solver.adb @@ -379,7 +379,7 @@ package body Alire.Solver is and then not Unavailable_Direct_Deps.Contains (Solution.Dependency (Crate)) - -- Because no release fulfills it, so "complete" + -- Because no release fulfills it, so "complete" then return False; end if; diff --git a/src/alire/alire-toml_adapters.ads b/src/alire/alire-toml_adapters.ads index 9d950142d..20e8262e5 100644 --- a/src/alire/alire-toml_adapters.ads +++ b/src/alire/alire-toml_adapters.ads @@ -141,7 +141,7 @@ package Alire.TOML_Adapters with Preelaborate is function "+" (Vect : AAA.Strings.Vector) return TOML.TOML_Value; function To_Array (V : TOML.TOML_Value) return TOML.TOML_Value with - Pre => V.Kind in TOML.Atom_Value_Kind or V.Kind = TOML.TOML_Array, + Pre => V.Kind in TOML.Atom_Value_Kind or else V.Kind = TOML.TOML_Array, Post => To_Array'Result.Kind = TOML.TOML_Array; -- Take an atom value and return an array of a single element -- If already an array, do nothing diff --git a/src/alire/alire-utils-regex.adb b/src/alire/alire-utils-regex.adb index 323839ade..903864bfc 100644 --- a/src/alire/alire-utils-regex.adb +++ b/src/alire/alire-utils-regex.adb @@ -8,8 +8,8 @@ package body Alire.Utils.Regex is function Escape (Literal : String) return String is Targets : constant String := "\()[].*+?^"; - Result : Ustring; - use Ustrings; + Result : UString; + use UStrings; begin for Char of Literal loop if (for some Nono of Targets => Char = Nono) then diff --git a/src/alire/alire-utils-tools.adb b/src/alire/alire-utils-tools.adb index 6845fad50..2e7241c5e 100644 --- a/src/alire/alire-utils-tools.adb +++ b/src/alire/alire-utils-tools.adb @@ -64,7 +64,8 @@ package body Alire.Utils.Tools is when Easy_Graph => (if Distribution in Centos | Fedora | Rhel | Suse then "perl-Graph-Easy" - elsif Distribution /= Msys2 and Distribution /= Arch + elsif Distribution /= Msys2 and then + Distribution /= Arch then "libgraph-easy-perl" else ""), when Git | Tar | Unzip | Curl => diff --git a/src/alire/alire-vcss.adb b/src/alire/alire-vcss.adb index 90d4cb276..52ba6c29b 100644 --- a/src/alire/alire-vcss.adb +++ b/src/alire/alire-vcss.adb @@ -35,7 +35,7 @@ package body Alire.VCSs is ---------- function Kind (Origin : URL) return Kinds is - (if Has_Prefix (Origin, "git+") or Has_Prefix (Origin, "git@") + (if Has_Prefix (Origin, "git+") or else Has_Prefix (Origin, "git@") then VCS_Git else VCS_Unknown); diff --git a/src/alr/alr-commands-edit.adb b/src/alr/alr-commands-edit.adb index 2770d274a..d0de9820a 100644 --- a/src/alr/alr-commands-edit.adb +++ b/src/alr/alr-commands-edit.adb @@ -29,7 +29,7 @@ package body Alr.Commands.Edit is Put_Info ("The editor command has been unset."); end if; - Put_Info ("You can change this setting by running the following command:"); + Put_Info ("You can change editors by running the following command:"); Put_Info ("`alr edit " & Switch_Select & "`"); end Set_Config_Cmd; @@ -62,7 +62,7 @@ package body Alr.Commands.Edit is procedure Query_Editor is use AAA.Strings; - use Clic.User_Input; + use CLIC.User_Input; package Builtins renames Alire.Config.Builtins; diff --git a/src/alr/alr-commands-edit.ads b/src/alr/alr-commands-edit.ads index 9ade94d55..4854dcf70 100644 --- a/src/alr/alr-commands-edit.ads +++ b/src/alr/alr-commands-edit.ads @@ -35,6 +35,6 @@ private type Command is new Commands.Command with record Prj : aliased GNAT.Strings.String_Access; - Set : aliased Boolean; --select-editor + Set : aliased Boolean; -- --select-editor end record; end Alr.Commands.Edit; diff --git a/src/alr/alr-commands-get.adb b/src/alr/alr-commands-get.adb index 8daa34980..3f1145d92 100644 --- a/src/alr/alr-commands-get.adb +++ b/src/alr/alr-commands-get.adb @@ -328,12 +328,12 @@ package body Alr.Commands.Get is Allowed : constant Alire.Dependencies.Dependency := Alire.Dependencies.From_String (Args (1)); begin - if Cmd.Build and Cmd.Only then + if Cmd.Build and then Cmd.Only then Reportaise_Wrong_Arguments ("--only is incompatible with --build"); end if; - if Cmd.Dirname and (Cmd.Build or else Cmd.Only) then + if Cmd.Dirname and then (Cmd.Build or else Cmd.Only) then Reportaise_Wrong_Arguments ("--dirname is incompatible with other switches"); end if; diff --git a/src/alr/alr-commands-printenv.adb b/src/alr/alr-commands-printenv.adb index c92bda012..a788bcccd 100644 --- a/src/alr/alr-commands-printenv.adb +++ b/src/alr/alr-commands-printenv.adb @@ -72,7 +72,7 @@ package body Alr.Commands.Printenv is & "because running " & TTY.Terminal ("alr printenv") & " after " & "manifest editions may trigger an automatic synchronization that " & "could produce extra output not intended as environment variables.") - .New_line + .New_Line .Append ("Examples:") .Append (" - eval $(alr -n -q printenv --unix)") .Append (" - alr -n -q printenv --powershell | Invoke-Expression") diff --git a/src/alr/alr-commands-show.adb b/src/alr/alr-commands-show.adb index 93094aeab..b18c55964 100644 --- a/src/alr/alr-commands-show.adb +++ b/src/alr/alr-commands-show.adb @@ -440,7 +440,7 @@ package body Alr.Commands.Show is end if; if Args.Count = 0 then - if Alire.Root.Current.Outside and not Cmd.Nested then + if Alire.Root.Current.Outside and then not Cmd.Nested then Reportaise_Wrong_Arguments ("Cannot proceed without a crate name"); elsif not Cmd.Nested then @@ -450,8 +450,8 @@ package body Alr.Commands.Show is if Cmd.External and then (Cmd.Dependents.all /= "unset" - or Cmd.Detect or Cmd.Jekyll or Cmd.Graph or Cmd.Solve - or Cmd.Tree) + or else Cmd.Detect or else Cmd.Jekyll or else Cmd.Graph + or else Cmd.Solve or else Cmd.Tree) then Reportaise_Wrong_Arguments ("Switch --external can only be combined with --system"); diff --git a/src/alr/alr-commands-toolchain.adb b/src/alr/alr-commands-toolchain.adb index cdfa6f842..27e6ca068 100644 --- a/src/alr/alr-commands-toolchain.adb +++ b/src/alr/alr-commands-toolchain.adb @@ -418,12 +418,12 @@ package body Alr.Commands.Toolchain is ("The provided switches cannot be used simultaneously"); end if; - if (Cmd.Install or Cmd.Uninstall) and then Args.Is_Empty then + if (Cmd.Install or else Cmd.Uninstall) and then Args.Is_Empty then Reportaise_Wrong_Arguments ("No release specified"); end if; if not Args.Is_Empty and then - not (Cmd.Install or Cmd.Uninstall or Cmd.S_Select) + not (Cmd.Install or else Cmd.Uninstall or else Cmd.S_Select) then Reportaise_Wrong_Arguments ("Specify the action to perform with the crate");