Skip to content

Add --hide_progress command-line flag to suppress progress bar#264

Merged
soimkim merged 4 commits intomainfrom
performance
Mar 31, 2026
Merged

Add --hide_progress command-line flag to suppress progress bar#264
soimkim merged 4 commits intomainfrom
performance

Conversation

@soimkim
Copy link
Copy Markdown
Contributor

@soimkim soimkim commented Mar 31, 2026

Description

Add --hide_progress command-line flag to suppress progress bar output during scanning operations.

@soimkim soimkim marked this pull request as draft March 31, 2026 01:32
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1617a046-6701-4573-802f-46e05972a07b

📥 Commits

Reviewing files that changed from the base of the PR and between 85c2af1 and dbb9309.

📒 Files selected for processing (2)
  • pyproject.toml
  • src/fosslight_source/run_scanoss.py
✅ Files skipped from review due to trivial changes (1)
  • pyproject.toml
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/fosslight_source/run_scanoss.py

📝 Walkthrough

Walkthrough

Adds a --hide_progress CLI flag and threads its boolean through scanner orchestration (CLI → run_scanners → merge_results → individual scanners). Removes TimerThread from main. KB file traversal now reports progress via tqdm, which respects the new flag. tqdm added to dependencies.

Changes

Cohort / File(s) Summary
Help Documentation
src/fosslight_source/_help.py
Added --hide_progress option to the CLI help text.
CLI Orchestration
src/fosslight_source/cli.py
Removed TimerThread creation/start. Added --hide_progress flag and threaded hide_progress: bool through main()run_scanners()merge_results() / scanner calls. KB traversal collects files then iterates with tqdm, disabling progress when hide_progress is true.
ScanCode Integration
src/fosslight_source/run_scancode.py
Extended run_scan() signature with hide_progress: bool = False and maps it to scancode.cli.run_scan via "quiet": hide_progress.
ScanOSS Integration
src/fosslight_source/run_scanoss.py
Extended run_scanoss_py() signature with hide_progress: bool = False. Added debug log lines around ScanOSS execution/parsing.
Project Configuration
pyproject.toml
Added tqdm to project dependencies for progress reporting.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant Orchestrator as run_scanners/merge_results
    participant KBScanner as KB traversal (tqdm)
    participant ScanCode
    participant ScanOSS

    CLI->>Orchestrator: parse args (including --hide_progress)
    CLI->>Orchestrator: call run_scanners(hide_progress)
    Orchestrator->>KBScanner: collect files_to_scan
    KBScanner-->>Orchestrator: iterate files with tqdm (disabled if hide_progress)
    Orchestrator->>ScanCode: run_scan(..., hide_progress)
    Orchestrator->>ScanOSS: run_scanoss_py(..., hide_progress)
    ScanCode-->>Orchestrator: scan results
    ScanOSS-->>Orchestrator: scanoss results
    Orchestrator-->>CLI: merged results
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #254: Modifies KB-related execution in cli.py regarding KB scanning workflow and file traversal handling.

Suggested labels

chore

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding a --hide_progress command-line flag to suppress the progress bar during scanning operations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch performance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (2)
src/fosslight_source/run_scancode.py (1)

66-66: Mutable default argument should be replaced with None.

The excluded_files: list = [] uses a mutable default which can lead to unexpected behavior if the list is modified. While this parameter pre-existed this PR, the static analysis correctly flags this issue.

♻️ Proposed fix
-    excluded_files: list = [], hide_progress: bool = False
+    excluded_files: list = None, hide_progress: bool = False
 ) -> Tuple[bool, str, list, list]:
     if not called_by_cli:
         global logger
+    if excluded_files is None:
+        excluded_files = []
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/fosslight_source/run_scancode.py` at line 66, The parameter
excluded_files currently uses a mutable default (excluded_files: list = [])
which can cause state leakage; change the function signature to default
excluded_files to None (excluded_files: Optional[list] = None) and inside the
function initialize it with excluded_files = [] if excluded_files is None;
update any type hints/imports (e.g., add typing.Optional if needed) and ensure
all uses of excluded_files in run_scancode (and any helper methods called from
it) rely on the initialized local list rather than mutating a module-level
default.
src/fosslight_source/cli.py (1)

318-318: Use explicit Optional type hint for nullable parameter.

PEP 484 prohibits implicit Optional. The type should be explicit: set | None or Optional[set].

♻️ Proposed fix
 def merge_results(
     scancode_result: list = [], scanoss_result: list = [], spdx_downloads: dict = {},
     path_to_scan: str = "", run_kb: bool = False, manifest_licenses: dict = {},
-    excluded_files: set = None, hide_progress: bool = False
+    excluded_files: set | None = None, hide_progress: bool = False
 ) -> list:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/fosslight_source/cli.py` at line 318, The parameter excluded_files
currently uses an implicit nullable type "set = None"; update its annotation to
an explicit Optional by changing the signature for the function that declares
excluded_files to use either "Optional[set]" (and add "from typing import
Optional") or the PEP 604 form "set | None" so the parameter is explicitly
nullable; keep the default None and ensure the parameter name excluded_files
remains unchanged so callers still work.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/fosslight_source/cli.py`:
- Around line 367-384: The project uses tqdm (import tqdm and tqdm.tqdm in
src/fosslight_source/cli.py) but it isn't declared as a dependency; update
pyproject.toml by adding "tqdm" to the dependencies list so the package consumer
won't get ModuleNotFoundError at runtime, and ensure the version specifier
follows your project's dependency format.

In `@src/fosslight_source/run_scanoss.py`:
- Line 79: The logger.debug call in src/fosslight_source/run_scanoss.py uses an
unnecessary f-string (logger.debug(f"|---SCANOSS Parsing")), so change it to a
plain string by removing the f prefix and using logger.debug("|---SCANOSS
Parsing") to avoid creating an unnecessary formatted string.
- Around line 63-71: The Scanner constructor call includes an unsupported
keyword argument quiet which causes a TypeError; remove the unsupported argument
by deleting quiet=hide_progress from the Scanner(...) instantiation so the
Scanner is constructed with only supported parameters (ignore_cert_errors,
skip_folders, scan_output, scan_options, nb_threads, scanoss_settings);
reference the Scanner class and the hide_progress variable to locate and update
the instantiation.

---

Nitpick comments:
In `@src/fosslight_source/cli.py`:
- Line 318: The parameter excluded_files currently uses an implicit nullable
type "set = None"; update its annotation to an explicit Optional by changing the
signature for the function that declares excluded_files to use either
"Optional[set]" (and add "from typing import Optional") or the PEP 604 form "set
| None" so the parameter is explicitly nullable; keep the default None and
ensure the parameter name excluded_files remains unchanged so callers still
work.

In `@src/fosslight_source/run_scancode.py`:
- Line 66: The parameter excluded_files currently uses a mutable default
(excluded_files: list = []) which can cause state leakage; change the function
signature to default excluded_files to None (excluded_files: Optional[list] =
None) and inside the function initialize it with excluded_files = [] if
excluded_files is None; update any type hints/imports (e.g., add typing.Optional
if needed) and ensure all uses of excluded_files in run_scancode (and any helper
methods called from it) rely on the initialized local list rather than mutating
a module-level default.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ec957ec8-f72f-4a85-94e2-ef65eb71bc58

📥 Commits

Reviewing files that changed from the base of the PR and between 04c3e63 and 85c2af1.

📒 Files selected for processing (4)
  • src/fosslight_source/_help.py
  • src/fosslight_source/cli.py
  • src/fosslight_source/run_scancode.py
  • src/fosslight_source/run_scanoss.py

@soimkim soimkim force-pushed the performance branch 3 times, most recently from 6432087 to 85c2af1 Compare March 31, 2026 12:17
@soimkim soimkim self-assigned this Mar 31, 2026
@soimkim soimkim added the chore [PR/Issue] Refactoring, maintenance the code label Mar 31, 2026
@soimkim soimkim marked this pull request as ready for review March 31, 2026 12:40
@soimkim soimkim changed the title Performance Add --hide_progress command-line flag to suppress progress bar Mar 31, 2026
@soimkim soimkim merged commit 0e2bbb2 into main Mar 31, 2026
5 of 7 checks passed
@soimkim soimkim deleted the performance branch March 31, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore [PR/Issue] Refactoring, maintenance the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant