2424from fosslight_util .timer_thread import TimerThread
2525import fosslight_util .constant as constant
2626from fosslight_util .output_format import check_output_format
27+ from fosslight_prechecker ._precheck import run_lint as prechecker_lint
2728from fosslight_util .cover import CoverItem
2829from fosslight_util .oss_item import ScannerItem
2930from fosslight_util .output_format import write_output_file
5051_executed_path = ""
5152SRC_DIR_FROM_LINK_PREFIX = "fosslight_src_dir_"
5253SCANNER_MODE = [
53- "all" , "compare" , "binary" ,
54+ "all" , "compare" , "reuse" , "prechecker" , " binary" ,
5455 "bin" , "src" , "source" , "dependency" , "dep"
5556]
5657
@@ -151,7 +152,14 @@ def run_scanner(src_path, dep_arguments, output_path, keep_raw_data=False,
151152 if success :
152153 output_files = {"SRC" : f"fosslight_src_{ _start_time } { output_extension } " ,
153154 "BIN" : f"fosslight_bin_{ _start_time } { output_extension } " ,
154- "DEP" : f"fosslight_dep_{ _start_time } { output_extension } " }
155+ "DEP" : f"fosslight_dep_{ _start_time } { output_extension } " ,
156+ "PRECHECKER" : f"fosslight_lint_{ _start_time } .yaml" }
157+ if run_prechecker :
158+ output_prechecker = os .path .join (_output_dir , output_files ["PRECHECKER" ])
159+ success , result = call_analysis_api (src_path , "Prechecker Lint" ,
160+ - 1 , prechecker_lint ,
161+ abs_path , False , output_prechecker ,
162+ exclude_path = path_to_exclude )
155163
156164 if run_src :
157165 try :
@@ -389,21 +397,27 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
389397 run_src = False
390398 run_bin = False
391399 run_dep = False
400+ run_prechecker = False
392401 remove_downloaded_source = False
393402
394403 if "all" in mode_list or (not mode_list ):
395404 run_src = True
396405 run_bin = True
397406 run_dep = True
407+ run_prechecker = False
408+ if "prechecker" in mode_list or "reuse" in mode_list :
409+ run_prechecker = True
398410 else :
411+ if "prechecker" in mode_list or "reuse" in mode_list :
412+ run_prechecker = True
399413 if "binary" in mode_list or "bin" in mode_list :
400414 run_bin = True
401415 if "source" in mode_list or "src" in mode_list :
402416 run_src = True
403417 if "dependency" in mode_list or "dep" in mode_list :
404418 run_dep = True
405419
406- if run_dep or run_src or run_bin :
420+ if run_dep or run_src or run_bin or run_prechecker :
407421 if src_path == "" and url_to_analyze == "" :
408422 src_path , dep_arguments , url_to_analyze = get_input_mode (_executed_path , mode_list )
409423
@@ -425,7 +439,7 @@ def run_main(mode_list, path_arg, dep_arguments, output_file_or_dir, file_format
425439
426440 if src_path != "" :
427441 run_scanner (src_path , dep_arguments , output_path , keep_raw_data ,
428- run_src , run_bin , run_dep , '' ,
442+ run_src , run_bin , run_dep , run_prechecker ,
429443 remove_downloaded_source , {}, output_file ,
430444 output_extension , num_cores , db_url ,
431445 default_oss_name , default_oss_version , url_to_analyze ,
0 commit comments