From b4c9ba204b6c9fd59ef25e810431a3fc2027e4ef Mon Sep 17 00:00:00 2001
From: Viljar Indus <indus@adacore.com>
Date: Thu, 28 Nov 2024 12:44:37 +0200
Subject: [PATCH] ada: Remove level attribute from Rules in the SARIF report

A Rule object in the SARIF report does not have a level
attribute. Result objects are the elements in the SARIF
reprot that have a level attribute that ultimately determines
the level of each diagnostic object.

Rules can have a defaultConfiguration attribute which has a level
attribute that can be overridden in multiple ways. This can make
the overall report more complex than it needs to be. It is simpler
to remove the attribute from rules where it does not really matter
and add it back in under the defaultConfiguration when there is an
explicit need for it.

gcc/ada/ChangeLog:

	* diagnostics-sarif_emitter.adb (Print_Rule): Remove printing
	of the level attribute since it does not match the SARIF schema.
---
 gcc/ada/diagnostics-sarif_emitter.adb | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/gcc/ada/diagnostics-sarif_emitter.adb b/gcc/ada/diagnostics-sarif_emitter.adb
index b6035c2970d6..f0be97d1a1ea 100644
--- a/gcc/ada/diagnostics-sarif_emitter.adb
+++ b/gcc/ada/diagnostics-sarif_emitter.adb
@@ -229,12 +229,10 @@ package body Diagnostics.SARIF_Emitter is
    procedure Print_Rule (Diag : Diagnostic_Type);
    --  Print a rule node that consists of the following attributes:
    --  * ruleId
-   --  * level
    --  * name
    --
    --  {
    --    "id": <Diag.Id>,
-   --    "level": <Diag.Kind>,
    --    "name": <Human_Id(Diag)>
    --  },
 
@@ -1006,10 +1004,6 @@ package body Diagnostics.SARIF_Emitter is
       Write_Char (',');
       NL_And_Indent;
 
-      Write_String_Attribute ("level", Kind_To_String (Diag));
-      Write_Char (',');
-      NL_And_Indent;
-
       if Human_Id = null then
          Write_String_Attribute ("name", "Uncategorized_Diagnostic");
       else
-- 
GitLab