From 72574cff2a4d6ad9ccb6d6e9397173739651ca66 Mon Sep 17 00:00:00 2001 From: Joao Azevedo Date: Tue, 25 Feb 2025 10:58:58 +0000 Subject: [PATCH] Use GNATformat edge --- .gitlab-ci.yml | 2 ++ src/metrics-actions.adb | 4 ++-- src/pp-actions.adb | 19 +++++++++---------- src/pp-formatting.adb | 8 ++++---- src/test-actions.adb | 2 +- src/test-skeleton.adb | 8 ++++---- 6 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a9444a45..1da55bdf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,8 @@ include: stage: check anod-spec: libadalang-tools gnatformat-args: -P src/build.gpr --check + install-gnatformat: true + install-gnatformat-extra-anod-args: -Qedge # Build - component: $CI_SERVER_FQDN/eng/gitlab-templates/build@~latest diff --git a/src/metrics-actions.adb b/src/metrics-actions.adb index 5ddcf121..92848144 100644 --- a/src/metrics-actions.adb +++ b/src/metrics-actions.adb @@ -2675,7 +2675,7 @@ package body METRICS.Actions is Assert (Global_M.Vals (Complexity_Cyclomatic) = Global_M.Vals (Complexity_Statement) - + Global_M.Vals (Complexity_Expression)); + + Global_M.Vals (Complexity_Expression)); -- We're done with Metrix_Stack at this point. Printing uses the tree -- formed by Submetrix. @@ -4623,7 +4623,7 @@ package body METRICS.Actions is Assert (File_M.Vals (Complexity_Cyclomatic) = File_M.Vals (Complexity_Statement) - + File_M.Vals (Complexity_Expression)); + + File_M.Vals (Complexity_Expression)); if Debug_Flag_V then Outdent; diff --git a/src/pp-actions.adb b/src/pp-actions.adb index 8f1bf15d..a2e5e738 100644 --- a/src/pp-actions.adb +++ b/src/pp-actions.adb @@ -2726,12 +2726,12 @@ package body Pp.Actions is (if Id (1) = ''' then As_Declared elsif Id (1) = '"' -- operator symbol - -- Kind not in Ada_Attribute_Ref | Ada_Update_Attribute_Ref - -- and then - -- (Id (1) = '"') -- operator symbol - -- or else Is_Reserved_Word (Id, Utils.Ada_Version) - -- or else Id = Name_And_Then - -- or else Id = Name_Or_Else) + -- Kind not in Ada_Attribute_Ref | Ada_Update_Attribute_Ref + -- and then + -- (Id (1) = '"') -- operator symbol + -- or else Is_Reserved_Word (Id, Utils.Ada_Version) + -- or else Id = Name_And_Then + -- or else Id = Name_Or_Else) then PP_Keyword_Casing (Cmd) elsif Is_Predef and then Use_Predefined_Casing then As_Declared else @@ -3812,10 +3812,9 @@ package body Pp.Actions is if Inst_Index < TT.Instructions'Last and then TT.Instructions (Inst_Index + 1) - = - (Kind => Verbatim, - T_Kind => Spaces, - Text => Name_Space) + = (Kind => Verbatim, + T_Kind => Spaces, + Text => Name_Space) then Inst_Index := Inst_Index + 1; end if; diff --git a/src/pp-formatting.adb b/src/pp-formatting.adb index 676742dd..9eba2bbd 100644 --- a/src/pp-formatting.adb +++ b/src/pp-formatting.adb @@ -2327,7 +2327,7 @@ package body Pp.Formatting is (All_LB, All_LBI (F), All_LBI (Next_Enabled (Lines_Data, F))) - + Offset); + + Offset); F := L; end loop; -- through line breaks @@ -2637,7 +2637,7 @@ package body Pp.Formatting is elsif Kind (Src_Tok) = '(' and then Kind (Prev_Lexeme (Src_Tok)) = '(' - --???Also check that the one before that is a tick! + --???Also check that the one before that is a tick! then Qual_Nesting := Qual_Nesting + 1; Next_ss (Src_Tok); @@ -4552,8 +4552,8 @@ package body Pp.Formatting is elsif LB.Indentation /= L_Paren_Indent_For_Preserve - + Before_Indentation - + 1 + + Before_Indentation + + 1 then LB.Indentation := L_Paren_Indent_For_Preserve diff --git a/src/test-actions.adb b/src/test-actions.adb index da3b441f..bb3168b8 100644 --- a/src/test-actions.adb +++ b/src/test-actions.adb @@ -824,7 +824,7 @@ package body Test.Actions is (Dir.Display_Full_Name, Resolve_Links => False, Case_Sensitive => False) - & Directory_Separator + & Directory_Separator then Cmd_Error_No_Help ("invalid harness directory, cannot mix up " diff --git a/src/test-skeleton.adb b/src/test-skeleton.adb index 38995113..30ec9f94 100755 --- a/src/test-skeleton.adb +++ b/src/test-skeleton.adb @@ -1584,8 +1584,8 @@ package body Test.Skeleton is if Owner_Decl /= No_Base_Type_Decl - -- If owner is incomplete private declaration (without "tagged" - -- keyword) subp should be treated as non-dispatching. + -- If owner is incomplete private declaration (without "tagged" + -- keyword) subp should be treated as non-dispatching. then if Owner_Decl.As_Base_Type_Decl.P_Is_Private then Owner_Decl := Owner_Decl.As_Base_Type_Decl.P_Private_Completion; @@ -8599,8 +8599,8 @@ package body Test.Skeleton is if MD.Short_Name_Used and then MD.Short_Name.all = Short_Name - -- It is hard to understand what happens when test case - -- name is changed, so we do not handle this scenario. + -- It is hard to understand what happens when test case + -- name is changed, so we do not handle this scenario. and then Markered_Data_Maps.Key (Cur).TC_Hash.all = TC_Hash then exit;