File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 1010import re
1111import sys
1212import time
13+ import urllib .parse
1314
1415import requests
1516import yaml
@@ -181,6 +182,24 @@ def unescape_chars(s):
181182
182183 return s
183184
185+ def markdown_url (label , url ):
186+ return f"[{ label } ]({ url } )"
187+
188+ def diagnostic_name_visual (diagnostic_name ):
189+ visual = f"**{ markdown (diagnostic_name )} **"
190+
191+ try :
192+ first_dash_idx = diagnostic_name .index ("-" )
193+ except ValueError :
194+ return visual
195+
196+ namespace = urllib .parse .quote_plus (diagnostic_name [:first_dash_idx ])
197+ check_name = urllib .parse .quote_plus (diagnostic_name [first_dash_idx + 1 :])
198+ return markdown_url (
199+ visual ,
200+ f"https://clang.llvm.org/extra/clang-tidy/checks/{ namespace } /{ check_name } .html" ,
201+ )
202+
184203 def generate_single_comment (
185204 file_path ,
186205 start_line_num ,
@@ -189,12 +208,12 @@ def generate_single_comment(
189208 message ,
190209 single_comment_marker ,
191210 replacement_text = None ,
192- ): # pylint: disable=too-many-arguments,too-many-positional-arguments
211+ ): # pylint: disable=too-many-arguments,too-many-positional-arguments,line-too-long
193212 result = {
194213 "path" : file_path ,
195214 "line" : end_line_num ,
196215 "side" : "RIGHT" ,
197- "body" : f"{ single_comment_marker } ** { markdown (name )} ** { single_comment_marker } \n "
216+ "body" : f"{ single_comment_marker } { diagnostic_name_visual (name )} { single_comment_marker } \n "
198217 + markdown (message ),
199218 }
200219
You can’t perform that action at this time.
0 commit comments