From 976c79149ba4af91f8a32efb82c282dcdc0ff1bd Mon Sep 17 00:00:00 2001 From: Wonjae Park Date: Tue, 19 May 2026 16:27:36 +0900 Subject: [PATCH] fix(report): exclude OSS info correction files Signed-off-by: Wonjae Park --- src/fosslight_source/cli.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/fosslight_source/cli.py b/src/fosslight_source/cli.py index 3b9d5b1..5318667 100755 --- a/src/fosslight_source/cli.py +++ b/src/fosslight_source/cli.py @@ -9,6 +9,7 @@ import time import warnings import logging +import re import urllib.request import urllib.error from datetime import datetime @@ -18,6 +19,7 @@ from ._license_matched import get_license_list_to_print from fosslight_util.output_format import check_output_formats_v2, write_output_file from fosslight_util.correct import correct_with_yaml +from fosslight_util.parsing_yaml import SUPPORT_OSS_INFO_FILES from .run_scancode import run_scan from fosslight_util.exclude import get_excluded_paths from .run_scanoss import run_scanoss_py @@ -43,6 +45,7 @@ KB_REFERENCE_HEADER = ['ID', 'Source Path', 'KB Origin URL', 'Evidence'] ALL_MODE = 'all' SCANNER_TYPE = ['kb', 'scancode', 'scanoss', ALL_MODE] +OSS_INFO_CORRECTION_COMMENT = "Excluded because it's OSS info correction file" logger = logging.getLogger(constant.LOGGER_NAME) @@ -312,6 +315,14 @@ def get_kb_reference_to_print(merged_result: list) -> list: return data +def mark_oss_info_correction_files_as_excluded(scan_results: list) -> None: + for item in scan_results: + file_name = os.path.basename(item.source_name_or_path).lower() + if any(re.search(pattern, file_name, re.IGNORECASE) for pattern in SUPPORT_OSS_INFO_FILES): + item.exclude = True + item.comment = OSS_INFO_CORRECTION_COMMENT + + def merge_results( scancode_result: list = [], scanoss_result: list = [], spdx_downloads: dict = {}, path_to_scan: str = "", run_kb: bool = False, manifest_licenses: dict = {}, @@ -483,6 +494,7 @@ def run_scanners( spdx_downloads, manifest_licenses = metadata_collector(path_to_scan, excluded_files) merged_result = merge_results(scancode_result, scanoss_result, spdx_downloads, path_to_scan, run_kb, manifest_licenses, excluded_files, hide_progress) + mark_oss_info_correction_files_as_excluded(merged_result) scan_item = create_report_file(start_time, merged_result, license_list, scanoss_result, selected_scanner, print_matched_text, output_path, output_files, output_extensions, correct_mode, correct_filepath, path_to_scan, excluded_path_without_dot, formats,