Skip to content

Keep copyright findings without full-file ScanCode output#294

Merged
soimkim merged 1 commit into
mainfrom
ref3
Jul 14, 2026
Merged

Keep copyright findings without full-file ScanCode output#294
soimkim merged 1 commit into
mainfrom
ref3

Conversation

@soimkim

@soimkim soimkim commented Jul 14, 2026

Copy link
Copy Markdown
Contributor
  • Improved scan results so files containing copyright information are retained even when no license is detected.
  • Refined non-UI result filtering to remove only entries lacking both license information and a download location.
  • Ensured UI mode continues to display relevant items, including entries without licenses or download locations.

Retain copyright-only ScanCode rows for ScanOSS/KB merge, use
only_findings except in UI mode, and drop empty download+license rows
when not in UI mode.
@soimkim soimkim self-assigned this Jul 14, 2026
@soimkim soimkim added the chore [PR/Issue] Refactoring, maintenance the code label Jul 14, 2026
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

ScanCode parsing now preserves copyright-only findings, while non-UI merging removes items lacking both download locations and licenses. The UI mode flag is propagated from scanner execution into result merging, with related documentation and formatting updates.

Changes

Scan result filtering

Layer / File(s) Summary
Copyright-aware ScanCode parsing
src/fosslight_source/_parsing_scancode_file_item.py
Both parsing paths retain copyright-bearing files and skip only files lacking licenses and copyright values in non-UI mode.
Mode-specific merged result filtering
src/fosslight_source/cli.py
merge_results accepts ui_mode and filters merged items with empty download locations and no licenses when UI mode is disabled.
Scanner mode propagation
src/fosslight_source/cli.py, src/fosslight_source/run_scancode.py
run_scanners passes ui_mode into merging, and related ScanCode documentation and call formatting are updated.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant run_scanners
  participant merge_results
  participant SourceItem
  run_scanners->>merge_results: pass ui_mode
  merge_results->>SourceItem: evaluate download location and licenses
  SourceItem-->>merge_results: filtering status
  merge_results-->>run_scanners: merged results
Loading

Suggested labels: enhancement

🚥 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 captures the main change: preserving copyright findings even when ScanCode doesn't return full-file output.
✨ 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.

@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 (1)
src/fosslight_source/cli.py (1)

395-397: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Fix implicit Optional type hint.

As flagged by static analysis, using set = None without an explicit Optional or union type violates PEP 484. Please update the type hint to Optional[set] = None (or set | None = None depending on the minimum Python version).

♻️ Proposed refactor
-    excluded_files: set = None, hide_progress: bool = False, kb_url: str = "", kb_token: str = "",
+    excluded_files: Optional[set] = None, hide_progress: bool = False, kb_url: str = "", kb_token: str = "",
     ui_mode: bool = False

(Ensure Optional is imported from typing if not already present.)

🤖 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 395 - 397, Update the function
parameter `excluded_files` to explicitly allow `None` using `Optional[set]` or
the project’s supported union syntax, preserving its default value; import
`Optional` from `typing` if needed.

Source: Linters/SAST tools

🤖 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 395-397: Update the function parameter `excluded_files` to
explicitly allow `None` using `Optional[set]` or the project’s supported union
syntax, preserving its default value; import `Optional` from `typing` if needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d3cd789b-ce7b-4240-a622-011d9675fad0

📥 Commits

Reviewing files that changed from the base of the PR and between 1c198d9 and 575ab7f.

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

@soimkim
soimkim merged commit 8511050 into main Jul 14, 2026
8 checks passed
@soimkim
soimkim deleted the ref3 branch July 14, 2026 04:38
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