osmith has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-ci/+/43445?usp=email )


Change subject: lint: checkpatch: escape gerrit markdown chars
......................................................................

lint: checkpatch: escape gerrit markdown chars

Fix that some messages look wrong in gerrit, for example:
  "foo* bar" should be "foo *bar"
The asterisk symbols would be removed and the text between them would be
displayed in cursive.

Example: 
https://gerrit.osmocom.org/c/libosmocore/+/43443/comment/ad7b209c_7b2929c1/
Change-Id: Ic9cf1705fc17873c90b57725227a1a6a3d4cd699
---
M lint/checkpatch/checkpatch_json.py
1 file changed, 9 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/45/43445/1

diff --git a/lint/checkpatch/checkpatch_json.py 
b/lint/checkpatch/checkpatch_json.py
index c4ea3b0..c35c4f3 100755
--- a/lint/checkpatch/checkpatch_json.py
+++ b/lint/checkpatch/checkpatch_json.py
@@ -16,6 +16,14 @@
 list_temp = {}


+def gerrit_markdown_escape(msg):
+    """Escape characters that would get interpreted as markdown syntax in
+    gerrit comments. For example: "foo* bar" should be "foo *bar" """
+    msg = msg.replace("*", "\\*")
+    msg = msg.replace("`", "\\`")
+    return msg
+
+
 def update_struct(file_path, msg_output, line_number):
     if file_path not in list_temp:
         list_temp[file_path] = []
@@ -24,7 +32,7 @@
         "robot_run_id": sys.argv[3],
         "url": sys.argv[4],
         "line": line_number,
-        "message": msg_output,
+        "message": gerrit_markdown_escape(msg_output),
     }
     if error not in list_temp[file_path]:
         list_temp[file_path].append(error)

--
To view, visit https://gerrit.osmocom.org/c/osmo-ci/+/43445?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ic9cf1705fc17873c90b57725227a1a6a3d4cd699
Gerrit-Change-Number: 43445
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <[email protected]>

Reply via email to