From f7dd3f64c689d3c170a44c0bd423851eb6747d13 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Wed, 7 Aug 2019 16:28:32 +0200
Subject: [PATCH] [sarif] Enforce validator "everything must end with a ., not
 .\n" constraint

---
 src/plugins/markdown-report/sarif.ml     | 4 +++-
 src/plugins/markdown-report/sarif_gen.ml | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/plugins/markdown-report/sarif.ml b/src/plugins/markdown-report/sarif.ml
index a1e32ad602c..d7ada712ff5 100644
--- a/src/plugins/markdown-report/sarif.ml
+++ b/src/plugins/markdown-report/sarif.ml
@@ -77,7 +77,9 @@ let plain_text ~text ?id:messageId ?arguments () =
   create ~text ?messageId ?arguments ()
 
 let markdown ~markdown ?id:richMessageId ?arguments () =
-  let richText = Format.asprintf "@[%a@]" Markdown.pp_elements markdown in
+  let richText =
+    String.trim (Format.asprintf "@[%a@]" Markdown.pp_elements markdown)
+  in
   create ~richText ?richMessageId ?arguments ()
 
 let default = create ()
diff --git a/src/plugins/markdown-report/sarif_gen.ml b/src/plugins/markdown-report/sarif_gen.ml
index f595292e485..217bbef068a 100644
--- a/src/plugins/markdown-report/sarif_gen.ml
+++ b/src/plugins/markdown-report/sarif_gen.ml
@@ -51,7 +51,9 @@ let make_message alarm annot remark =
       | [] -> summary :: gen_remark alarm
       | _ -> summary :: remark
   in
-  let richText = Format.asprintf "@[%a@]" Markdown.pp_elements markdown in
+  let richText =
+    String.trim (Format.asprintf "@[%a@]" Markdown.pp_elements markdown)
+  in
   Message.create ~text ~richText ()
 
 let gen_results remarks =
-- 
GitLab