Skip to content

Mark manifest files in UI mode without requiring licenses#295

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

Mark manifest files in UI mode without requiring licenses#295
soimkim merged 1 commit into
mainfrom
ref3

Conversation

@soimkim

@soimkim soimkim commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

When --ui is set, set is_manifest_file by filename even if manifest license extraction returns empty so callers can detect those rows.

@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

UI mode now carries manifest paths through metadata collection and result merging, preserving is_manifest_file flags even when license extraction returns no valid licenses.

Changes

UI Manifest Preservation

Layer / File(s) Summary
UI-mode manifest metadata collection
src/fosslight_source/cli.py
run_scanners passes ui_mode to metadata_collector, which includes manifest paths when license extraction succeeds or fails in UI mode.
Manifest flag preservation during merging
src/fosslight_source/cli.py
merge_results creates or marks manifest source items in UI mode even when extracted license lists are empty.

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

Suggested reviewers: justinwonjaepark

Sequence Diagram(s)

sequenceDiagram
  participant run_scanners
  participant metadata_collector
  participant merge_results
  participant SourceItem
  run_scanners->>metadata_collector: pass ui_mode
  metadata_collector-->>run_scanners: manifest metadata
  run_scanners->>merge_results: merge manifest licenses
  merge_results->>SourceItem: set is_manifest_file to true
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 reflects the main change: marking manifest files in UI mode even when no licenses are found.
✨ 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 (2)
src/fosslight_source/cli.py (2)

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

Update return type hint.

The type hint indicates the function returns a dict, but it actually returns a tuple of two dictionaries (spdx_downloads, manifest_licenses).

♻️ Proposed refactor
-def metadata_collector(path_to_scan: str, excluded_files: set, ui_mode: bool = False) -> dict:
+def metadata_collector(path_to_scan: str, excluded_files: set, ui_mode: bool = False) -> tuple[dict, dict]:
🤖 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` at line 714, Update the return type annotation
of metadata_collector to describe its actual two-element tuple result, with each
element typed as a dictionary. Leave the function’s runtime behavior unchanged.

502-507: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Optional: Remove redundant manifest file loop.

Since metadata_collector now retains all manifest files in manifest_licenses (even those without licenses) when ui_mode is True, and lines 454-461 already mark them in scancode_result, this secondary loop is generally redundant.

Unless there is a specific edge case where scancode_result receives manifest files that are not present on disk (and thus missed by metadata_collector), you can safely remove this to avoid running the regex match on every scanned item.

♻️ Proposed refactor
-    if ui_mode:
-        # Filename-based flag: license extraction success is not required in UI mode.
-        for item in scancode_result:
-            if is_manifest_file(item.source_name_or_path):
-                item.is_manifest_file = True
-
🤖 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 502 - 507, Remove the redundant
ui_mode loop that iterates over scancode_result and calls is_manifest_file; rely
on the existing manifest marking performed by metadata_collector and the earlier
scancode_result handling, while preserving all other UI-mode 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`:
- Line 714: Update the return type annotation of metadata_collector to describe
its actual two-element tuple result, with each element typed as a dictionary.
Leave the function’s runtime behavior unchanged.
- Around line 502-507: Remove the redundant ui_mode loop that iterates over
scancode_result and calls is_manifest_file; rely on the existing manifest
marking performed by metadata_collector and the earlier scancode_result
handling, while preserving all other UI-mode behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 62e75055-0377-45dd-a1da-24332044585d

📥 Commits

Reviewing files that changed from the base of the PR and between 8511050 and 9255f3b.

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

When --ui is set, set is_manifest_file by filename even if manifest
license extraction returns empty so callers can detect those rows.
@soimkim soimkim changed the title feat: mark manifest files in UI mode without requiring licenses Mark manifest files in UI mode without requiring licenses Jul 14, 2026
@soimkim soimkim self-assigned this Jul 14, 2026
@soimkim soimkim added the chore [PR/Issue] Refactoring, maintenance the code label Jul 14, 2026
@soimkim
soimkim merged commit 6d6e133 into main Jul 14, 2026
8 checks passed
@soimkim
soimkim deleted the ref3 branch July 14, 2026 21:11
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