|
12 | 12 | import fosslight_util.constant as constant |
13 | 13 | from fosslight_util.set_log import init_log |
14 | 14 | from fosslight_util.timer_thread import TimerThread |
| 15 | +from fosslight_util.scanned_result import excluding_files |
15 | 16 | from ._help import print_version, print_help_msg_source_scanner |
16 | 17 | from ._license_matched import get_license_list_to_print |
17 | 18 | from fosslight_util.output_format import check_output_formats_v2, write_output_file |
@@ -84,6 +85,7 @@ def main() -> None: |
84 | 85 | path_to_scan = ''.join(args.path) |
85 | 86 | if args.exclude: |
86 | 87 | path_to_exclude = args.exclude |
| 88 | + print("path_to_exclude in main : ", path_to_exclude) |
87 | 89 | if args.json: |
88 | 90 | write_json_file = True |
89 | 91 | output_file_name = ''.join(args.output) |
@@ -111,6 +113,7 @@ def main() -> None: |
111 | 113 | result = run_scanners(path_to_scan, output_file_name, write_json_file, core, True, |
112 | 114 | print_matched_text, formats, time_out, correct_mode, correct_filepath, |
113 | 115 | selected_scanner, path_to_exclude) |
| 116 | + sys.exit(0) |
114 | 117 |
|
115 | 118 | _result_log["Scan Result"] = result[1] |
116 | 119 |
|
@@ -329,6 +332,34 @@ def run_scanners( |
329 | 332 |
|
330 | 333 | logger, result_log = init_log(os.path.join(output_path, f"fosslight_log_src_{start_time}.txt"), |
331 | 334 | True, logging.INFO, logging.DEBUG, PKG_NAME, path_to_scan, path_to_exclude) |
| 335 | + # print("path_to_exclude : ", type(path_to_exclude), "||", path_to_exclude) |
| 336 | + # print("path_to_scan : ", type(path_to_scan), " || ", path_to_scan) |
| 337 | + |
| 338 | + # excluded_file_list = excluding_files(path_to_exclude, path_to_scan) |
| 339 | + # no = 0 |
| 340 | + # print("excluding_file_list : ", type(excluded_file_list)) |
| 341 | + # print(excluded_file_list) |
| 342 | + # for excluded_file in excluded_file_list: |
| 343 | + # no = no + 1 |
| 344 | + # print(no, ". ", excluded_file) |
| 345 | + |
| 346 | +# if __name__ == "__main__": |
| 347 | + test_cases = [ |
| 348 | + (["file1.js", "file2.py"], "./exclude_test"), |
| 349 | + (["sample/*"], "./exclude_test"), |
| 350 | + (["sample/subfolder/*"], "./exclude_test"), |
| 351 | + (["*.py"], "./exclude_test"), |
| 352 | + (["subfolder"], "./exclude_test"), |
| 353 | + ] |
| 354 | + |
| 355 | + for i, (patterns, path_to_scan) in enumerate(test_cases, 1): |
| 356 | + print(f"\n=== 케이스 {i} ===", patterns) |
| 357 | + excluding = excluding_files(patterns, path_to_scan) |
| 358 | + for r, re in enumerate(excluding, 1): |
| 359 | + print(f"{r}. {re}") |
| 360 | + # print("\n".join(result)) |
| 361 | + |
| 362 | + return 0 |
332 | 363 |
|
333 | 364 | if '.xlsx' not in output_extensions and print_matched_text: |
334 | 365 | logger.warning("-m option is only available for excel.") |
|
0 commit comments