osmith submitted this change.

View Change

Approvals: fixeria: Looks good to me, approved Jenkins Builder: Verified
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(-)

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 change 43445. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-Change-Id: Ic9cf1705fc17873c90b57725227a1a6a3d4cd699
Gerrit-Change-Number: 43445
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de>
Gerrit-Reviewer: osmith <osmith@sysmocom.de>