1313from fosslight_util .timer_thread import TimerThread
1414from ._help import print_version , print_help_msg_source_scanner
1515from ._license_matched import get_license_list_to_print
16- from fosslight_util .output_format import check_output_formats , write_output_file
16+ from fosslight_util .output_format import check_output_formats_v2 , write_output_file
1717from fosslight_util .correct import correct_with_yaml
1818from .run_scancode import run_scan
1919from .run_scanoss import run_scanoss_py
@@ -49,7 +49,7 @@ def main() -> None:
4949 write_json_file = False
5050 output_file_name = ""
5151 print_matched_text = False
52- formats = ""
52+ formats = []
5353 selected_scanner = ""
5454 correct_mode = True
5555
@@ -145,7 +145,8 @@ def create_report_file(
145145 selected_scanner : str , need_license : bool = False ,
146146 output_path : str = "" , output_files : list = [],
147147 output_extensions : list = [], correct_mode : bool = True ,
148- correct_filepath : str = "" , path_to_scan : str = "" , path_to_exclude : list = []
148+ correct_filepath : str = "" , path_to_scan : str = "" , path_to_exclude : list = [],
149+ formats : list = []
149150) -> 'ScannerItem' :
150151 """
151152 Create report files for given scanned result.
@@ -219,10 +220,10 @@ def create_report_file(
219220
220221 combined_paths_and_files = [os .path .join (output_path , file ) for file in output_files ]
221222 results = []
222- for combined_path_and_file , output_extension in zip (combined_paths_and_files , output_extensions ):
223+ for combined_path_and_file , output_extension , output_format in zip (combined_paths_and_files , output_extensions , formats ):
223224 # if need_license and output_extension == _json_ext and "scanoss_reference" in sheet_list:
224225 # del sheet_list["scanoss_reference"]
225- results .append (write_output_file (combined_path_and_file , output_extension , scan_item , extended_header , "" ))
226+ results .append (write_output_file (combined_path_and_file , output_extension , scan_item , extended_header , "" , output_format ))
226227 for success , msg , result_file in results :
227228 if success :
228229 logger .info (f"Output file: { result_file } " )
@@ -295,8 +296,9 @@ def run_scanners(
295296 license_list = []
296297 spdx_downloads = {}
297298 result_log = {}
299+ scan_item = []
298300
299- success , msg , output_path , output_files , output_extensions = check_output_formats (output_file_name , formats )
301+ success , msg , output_path , output_files , output_extensions , formats = check_output_formats_v2 (output_file_name , formats )
300302
301303 logger , result_log = init_log (os .path .join (output_path , f"fosslight_log_src_{ start_time } .txt" ),
302304 True , logging .INFO , logging .DEBUG , PKG_NAME , path_to_scan , path_to_exclude )
@@ -319,7 +321,7 @@ def run_scanners(
319321 merged_result = merge_results (scancode_result , scanoss_result , spdx_downloads )
320322 scan_item = create_report_file (start_time , merged_result , license_list , scanoss_result , selected_scanner ,
321323 print_matched_text , output_path , output_files , output_extensions , correct_mode ,
322- correct_filepath , path_to_scan , path_to_exclude )
324+ correct_filepath , path_to_scan , path_to_exclude , formats )
323325 else :
324326 print_help_msg_source_scanner ()
325327 result_log [RESULT_KEY ] = "Unsupported scanner"
0 commit comments