Skip to content

Skip ScanCode only-findings when --ui is set#293

Merged
soimkim merged 2 commits into
mainfrom
ref3
Jul 14, 2026
Merged

Skip ScanCode only-findings when --ui is set#293
soimkim merged 2 commits into
mainfrom
ref3

Conversation

@soimkim

@soimkim soimkim commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Pass ui_mode through to run_scan so UI mode receives all scanned files instead of findings-only ScanCode output.

Pass ui_mode through to run_scan so UI mode receives all scanned files
instead of findings-only ScanCode output.
@soimkim soimkim self-assigned this Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a --ui CLI flag, propagates its boolean value through scanner execution, and changes scancode output to include all scanned files when UI mode is enabled.

Changes

UI Mode Scan Routing

Layer / File(s) Summary
CLI UI mode propagation
src/fosslight_source/cli.py
Adds the --ui option and forwards ui_mode through run_scanners(...) to run_scan(...).
Scancode output scope
src/fosslight_source/run_scancode.py
Adds the ui_mode parameter and sets only_findings to not ui_mode.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: justinwonjaepark, bjk7119

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant run_scanners
  participant run_scan
  participant Scancode
  CLI->>CLI: Parse --ui into ui_mode
  CLI->>run_scanners: Pass ui_mode
  run_scanners->>run_scan: Pass ui_mode
  run_scan->>Scancode: Set only_findings to not ui_mode
  Scancode-->>run_scan: Return scan results
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: enabling --ui to bypass ScanCode only-findings behavior.
✨ 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 ref3

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.

When --ui is set, retain ScanCode file items even if no license was
detected so UI results include the full file list.
@soimkim soimkim added the chore [PR/Issue] Refactoring, maintenance the code label Jul 14, 2026
@soimkim soimkim changed the title feat: skip ScanCode only-findings when --ui is set Skip ScanCode only-findings when --ui is set Jul 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
src/fosslight_source/cli.py (1)

526-527: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Document the new ui_mode parameter.

Add a :param ui_mode: entry to the run_scanners docstring describing that UI mode requests all scanned files rather than findings-only output.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_source/cli.py` around lines 526 - 527, Update the run_scanners
docstring to add a :param ui_mode: entry, documenting that enabling UI mode
requests all scanned files instead of findings-only output.
src/fosslight_source/run_scancode.py (2)

273-277: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid the mutable excluded_files default.

Ruff flags excluded_files: list = [] (B006). Use a None default and initialize a fresh list inside run_scan() so callers cannot share mutable state across invocations.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_source/run_scancode.py` around lines 273 - 277, Update the
run_scan() signature to use None instead of a mutable default for
excluded_files, then initialize it to a new empty list inside run_scan() when no
value is provided, preserving caller-supplied lists.

Source: Linters/SAST tools


375-379: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add regression coverage for both scan scopes.

Verify that the default path passes only_findings=True and that ui_mode=True passes only_findings=False; the existing downstream test only exercises the findings-only case.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/fosslight_source/run_scancode.py` around lines 375 - 379, Extend the
tests covering the scan invocation to assert that the default path passes
only_findings=True and that the ui_mode=True path passes only_findings=False.
Reuse the existing downstream scan test setup and add coverage for both scan
scopes without changing the runtime behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/fosslight_source/cli.py`:
- Around line 526-527: Update the run_scanners docstring to add a :param
ui_mode: entry, documenting that enabling UI mode requests all scanned files
instead of findings-only output.

In `@src/fosslight_source/run_scancode.py`:
- Around line 273-277: Update the run_scan() signature to use None instead of a
mutable default for excluded_files, then initialize it to a new empty list
inside run_scan() when no value is provided, preserving caller-supplied lists.
- Around line 375-379: Extend the tests covering the scan invocation to assert
that the default path passes only_findings=True and that the ui_mode=True path
passes only_findings=False. Reuse the existing downstream scan test setup and
add coverage for both scan scopes without changing the runtime behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c00df291-13fb-496f-85de-35a7a99d7e5a

📥 Commits

Reviewing files that changed from the base of the PR and between 5822c22 and 87fe582.

📒 Files selected for processing (2)
  • src/fosslight_source/cli.py
  • src/fosslight_source/run_scancode.py

@soimkim
soimkim merged commit 1c198d9 into main Jul 14, 2026
8 checks passed
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