File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,6 +116,8 @@ def format_percentage(numerator, denominator):
116116 file .affectedFunctionPercentRepr = format_percentage (file .affectedFunctions , file .totalFunctions )
117117 file .affectedReferencePercentRepr = format_percentage (file .affectedReferences , file .totalReferences )
118118
119+ file_list .files = sort_files_by_impact (file_list .files )
120+
119121 cols = [
120122 "FileName" ,
121123 "AffectedLines" ,
@@ -141,6 +143,13 @@ def dot_to_svg(dot_file):
141143 return svg_bytes
142144
143145
146+ def sort_files_by_impact (files ):
147+ def sort_key (f ):
148+ return f .affectedLines
149+
150+ return sorted (files , key = sort_key , reverse = True )
151+
152+
144153def main ():
145154 args = sys .argv [1 :]
146155 lang = args [0 ]
@@ -186,17 +195,11 @@ def main():
186195
187196 # graph
188197 svg_bytes = dot_to_svg (dot_result_file )
189- response = requests .post ("https://sm.ms/api/v2/upload" , files = {"smfile" : svg_bytes })
190- if response .status_code == 200 :
191- url = response .json ()["data" ]["url" ]
192- else :
193- url = None
198+ # todo: have no idea about how to display this graph in comment without any extra servers
194199
195200 final_content = f"""
196201## [DiffCtx](https://github.com/williamfzc/diffctx) Report
197202
198- { url }
199-
200203{ md_table_raw }
201204"""
202205 logger .info (f"final comment: { final_content } " )
You can’t perform that action at this time.
0 commit comments