Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstate lost style checks #1591

Merged
merged 3 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions alire_common.gpr
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ abstract project Alire_Common is
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
"-gnatyg", -- Standard GNAT style = -gnatyydISuxz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One potential risk with gnatyg is that its definition can change in the future, which can bring some unwanted style errors.

Why not use our default style check switches for Alire crates?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess I prefer to make an sporadic fix if that happens rather than being unaware of recommended style changes.

-- where -gnatyy = gnaty3aAbcefhiklmnprst
-- which is all but -gnatyBoOx
"-gnatyO", -- explicitly mark all overrides
"-gnaty-s" -- don't require forward declarations
);
when "disabled" => Style_Check_Switches := ();
end case;

Expand Down
2 changes: 1 addition & 1 deletion src/alire/alire-errors.adb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ 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) = '.'
then Line (Line'First .. Line'Last - 1)
Expand Down
3 changes: 2 additions & 1 deletion src/alire/alire-publish.adb
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,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";
Expand Down
4 changes: 2 additions & 2 deletions src/alire/alire-roots.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/alire/alire-solutions-diffs.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/alire/alire-solutions.ads
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion src/alire/alire-solver.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/alire/alire-utils-regex.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/alr/alr-commands-edit.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion src/alr/alr-commands-edit.ads
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion src/alr/alr-commands-printenv.adb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading