@@ -294,10 +294,10 @@ def get_report_dir_status(compile_commands: list[dict[str, str]],
294294
295295 for c in compile_commands :
296296 for analyzer in supported_analyzers :
297- file , dir , cmd = c ["file" ], c ["directory" ], c ["command" ]
297+ file , directory , cmd = c ["file" ], c ["directory" ], c ["command" ]
298298
299299 filename = os .path .basename (file )
300- action_hash = analyzer_action_hash (file , dir , cmd )
300+ action_hash = analyzer_action_hash (file , directory , cmd )
301301
302302 plist_file = f"{ filename } _{ analyzer } _{ action_hash } .plist"
303303 plist_err_file = plist_file + ".err"
@@ -340,35 +340,33 @@ def get_report_dir_status(compile_commands: list[dict[str, str]],
340340 if detailed_flag :
341341 out_analyzers [analyzer ].update (detailed )
342342
343- """
344- Expected output format example
345-
346- {
347- "analyzers": {
348- "clangsa": {
349- "summary": {
350- "up-to-date": 2,
351- "outdated": 0,
352- "missing": 1,
353- "failed": 0,
354- "successful": 2
355- },
356- "up-to-date": [
357- "/workspace/tmp/foo.cpp",
358- "/workspace/tmp/bar.cpp",
359- ],
360- "outdated": [],
361- "missing": [
362- "/workspace/tmp/test.c"
363- ],
364- "failed": []
365- },
366- "clang-tidy": { ... },
367- },
368- "total_analyzed_compilation_commands": 2,
369- "total_available_compilation_commands": 3
370- }
371- """
343+ # Expected output format example
344+ #
345+ # {
346+ # "analyzers": {
347+ # "clangsa": {
348+ # "summary": {
349+ # "up-to-date": 2,
350+ # "outdated": 0,
351+ # "missing": 1,
352+ # "failed": 0,
353+ # "successful": 2
354+ # },
355+ # "up-to-date": [
356+ # "/workspace/tmp/foo.cpp",
357+ # "/workspace/tmp/bar.cpp",
358+ # ],
359+ # "outdated": [],
360+ # "missing": [
361+ # "/workspace/tmp/test.c"
362+ # ],
363+ # "failed": []
364+ # },
365+ # "clang-tidy": { ... },
366+ # },
367+ # "total_analyzed_compilation_commands": 2,
368+ # "total_available_compilation_commands": 3
369+ # }
372370
373371 return {
374372 "analyzers" : out_analyzers ,
@@ -412,8 +410,8 @@ def print_status(inputs: list[str],
412410
413411 if files :
414412 files_filter = [os .path .abspath (fp ) for fp in files ]
415- compile_commands = list (filter ( lambda c :
416- c ["file" ] in files_filter , compile_commands ))
413+ compile_commands = list (
414+ filter ( lambda c : c ["file" ] in files_filter , compile_commands ))
417415
418416 status = get_report_dir_status (compile_commands , report_dir , detailed_flag )
419417
@@ -442,7 +440,7 @@ def get_summary(analyzer):
442440 json .dump (status , sys .stdout , indent = 2 )
443441 elif export and output_path :
444442 output_path = os .path .abspath (output_path )
445- with open (output_path , "w" ) as file :
443+ with open (output_path , "w" , encoding = "utf-8" ) as file :
446444 json .dump (status , file , indent = 2 )
447445 LOG .info ("Status info was dumped to '%s'." , output_path )
448446
0 commit comments