-
Notifications
You must be signed in to change notification settings - Fork 12
Ignore binaries during ScanCode scan #265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,8 +113,8 @@ def run_scan( | |
| pretty_params["path_to_exclude"] = path_to_exclude | ||
| pretty_params["output_file"] = output_file_name | ||
| total_files_to_excluded = [] | ||
| abs_path_to_scan = os.path.abspath(path_to_scan) | ||
| if path_to_exclude: | ||
| abs_path_to_scan = os.path.abspath(path_to_scan) | ||
| for path in path_to_exclude: | ||
| if os.path.isabs(path): | ||
| exclude_path = os.path.relpath(path, abs_path_to_scan) | ||
|
|
@@ -156,6 +156,19 @@ def run_scan( | |
| else: | ||
| total_files_to_excluded.append(exclude_path_normalized) | ||
|
|
||
| for root, _, files in os.walk(path_to_scan): | ||
| for name in files: | ||
| full_path = os.path.join(root, name) | ||
| try: | ||
| if not check_binary(full_path, True): | ||
| continue | ||
| except Exception: | ||
| continue | ||
| rel_path = os.path.relpath(full_path, abs_path_to_scan) | ||
| rel_norm = os.path.normpath(rel_path).replace("\\", "/") | ||
| excluded_files.append(rel_norm) | ||
|
Comment on lines
+159
to
+169
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: head -70 src/fosslight_source/run_scancode.py | tail -20Repository: fosslight/fosslight_source_scanner Length of output: 832 🏁 Script executed: sed -n '50,85p' src/fosslight_source/run_scancode.pyRepository: fosslight/fosslight_source_scanner Length of output: 1436 🏁 Script executed: sed -n '159,175p' src/fosslight_source/run_scancode.pyRepository: fosslight/fosslight_source_scanner Length of output: 977 🏁 Script executed: sed -n '1,30p' src/fosslight_source/run_scancode.pyRepository: fosslight/fosslight_source_scanner Length of output: 1022 🏁 Script executed: rg "run_scan\(" -A 2 -B 2 --type pyRepository: fosslight/fosslight_source_scanner Length of output: 4170 🏁 Script executed: fd -e py -type f | xargs grep -l "run_scan" | head -10Repository: fosslight/fosslight_source_scanner Length of output: 248 🏁 Script executed: rg "run_scan\(" src/ tests/ -A 3 --type py | grep -A 3 "run_scan("Repository: fosslight/fosslight_source_scanner Length of output: 3763 🏁 Script executed: sed -n '1,300p' src/fosslight_source/cli.py | grep -A 10 "run_scan"Repository: fosslight/fosslight_source_scanner Length of output: 1101 🏁 Script executed: grep -n "excluded_files" src/fosslight_source/run_scancode.pyRepository: fosslight/fosslight_source_scanner Length of output: 344 🏁 Script executed: sed -n '100,160p' src/fosslight_source/cli.py | grep -A 15 "run_scan"Repository: fosslight/fosslight_source_scanner Length of output: 769 🏁 Script executed: sed -n '135,155p' src/fosslight_source/cli.pyRepository: fosslight/fosslight_source_scanner Length of output: 940 🏁 Script executed: grep -n "def run_scanners" src/fosslight_source/*.pyRepository: fosslight/fosslight_source_scanner Length of output: 127 🏁 Script executed: sed -n '90,150p' src/fosslight_source/cli.pyRepository: fosslight/fosslight_source_scanner Length of output: 2356 🏁 Script executed: sed -n '389,500p' src/fosslight_source/cli.pyRepository: fosslight/fosslight_source_scanner Length of output: 5896 🏁 Script executed: sed -n '389,600p' src/fosslight_source/cli.py | head -100Repository: fosslight/fosslight_source_scanner Length of output: 5506 Fix mutable default argument pattern for The function signature defines 🧰 Tools🪛 Ruff (0.15.7)[error] 165-166: (S112) [warning] 165-165: Do not catch blind exception: (BLE001) 🤖 Prompt for AI Agents |
||
| logger.debug(f"Excluded binary from scancode: {rel_norm}") | ||
|
Comment on lines
+159
to
+170
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Skip The new 🧰 Tools🪛 Ruff (0.15.7)[error] 165-166: (S112) [warning] 165-165: Do not catch blind exception: (BLE001) 🤖 Prompt for AI Agents |
||
|
|
||
| if excluded_files: | ||
| total_files_to_excluded.extend(f"**/{file_path}" for file_path in excluded_files) | ||
|
|
||
|
|
@@ -207,7 +220,7 @@ def run_scan( | |
| for scan_item in result_list: | ||
| if os.path.isdir(scan_item.source_name_or_path): | ||
| continue | ||
| if check_binary(os.path.join(path_to_scan, scan_item.source_name_or_path)): | ||
| if check_binary(os.path.join(path_to_scan, scan_item.source_name_or_path), True): | ||
| scan_item.exclude = True | ||
| except Exception as ex: | ||
| success = False | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.