Skip to content

Keep non-FSF copyrights in GPL license text files - #303

Merged
soimkim merged 3 commits into
mainfrom
fix/fsf_copyright_remove
Aug 10, 2026
Merged

Keep non-FSF copyrights in GPL license text files#303
soimkim merged 3 commits into
mainfrom
fix/fsf_copyright_remove

Conversation

@JustinWonjaePark

@JustinWonjaePark JustinWonjaePark commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
  • Bug Fixes
    • Improved GPL license-text parsing by excluding only copyright entries associated with the Free Software Foundation.
    • Preserved other valid copyright information instead of removing all copyright entries.

@JustinWonjaePark JustinWonjaePark self-assigned this Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds a shared helper that removes copyright entries containing “free software foundation” from GPL-family license text. Both ScanCode parser paths use the helper and retain other copyright entries. Tests cover GPL-family and non-applicable inputs.

Changes

GPL copyright filtering

Layer / File(s) Summary
Copyright filter and parser integration
src/fosslight_source/_parsing_scancode_file_item.py, tests/test_tox.py
The code uses a compiled case-insensitive GPL pattern and shared FSF marker. Both parser paths apply selective filtering. Tests cover GPL-family, mixed, non-GPL, non-license-text, and empty-license inputs.

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

Suggested labels: bug fix

Suggested reviewers: soimkim

🚥 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 and concisely describes the main change: preserving non-FSF copyrights in GPL license text files.
✨ 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 fix/fsf_copyright_remove

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.

@JustinWonjaePark
JustinWonjaePark marked this pull request as ready for review August 10, 2026 01:26

@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.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/fosslight_source/_parsing_scancode_file_item.py (1)

233-235: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick win

Add regression coverage for both parser paths.

The supplied test at tests/test_tox.py:113-137 verifies only the GPL-family gate. Add cases for mixed-case Free Software Foundation text and another copyright entry. Assert that both parsing_scancode_32_earlier and parsing_scancode_32_later remove only the FSF entry.

Also applies to: 730-732

🤖 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/_parsing_scancode_file_item.py` around lines 233 - 235,
Add regression tests covering both parsing_scancode_32_earlier and
parsing_scancode_32_later with mixed-case “Free Software Foundation” text plus
another copyright entry; assert each parser removes only the FSF entry while
preserving the other entry, without changing the existing GPL-family coverage.
🤖 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.

Inline comments:
In `@src/fosslight_source/_parsing_scancode_file_item.py`:
- Around line 63-69: In exclude_free_software_foundation_copyrights, rename the
list-comprehension variable copyright to a non-shadowing name such as
copyright_entry and update its references within the comprehension, preserving
the existing filtering behavior.

---

Nitpick comments:
In `@src/fosslight_source/_parsing_scancode_file_item.py`:
- Around line 233-235: Add regression tests covering both
parsing_scancode_32_earlier and parsing_scancode_32_later with mixed-case “Free
Software Foundation” text plus another copyright entry; assert each parser
removes only the FSF entry while preserving the other entry, without changing
the existing GPL-family coverage.
🪄 Autofix

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 Plus

Run ID: df5652c6-45ea-41ae-b6b8-436d62bd049c

📥 Commits

Reviewing files that changed from the base of the PR and between e4c9c3a and 8149292.

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

Comment thread src/fosslight_source/_parsing_scancode_file_item.py Outdated
Signed-off-by: Park Wonjae <wonjae.park@lge.com>
Collapse GPL-family detection and FSF copyright exclusion into a single
filter so call sites no longer need separate predicates and branches.
@soimkim soimkim added the bug fix [PR] Fix the bug label Aug 10, 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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@src/fosslight_source/_parsing_scancode_file_item.py`:
- Around line 216-218: Update the legacy parser’s license-item aggregation
around result_item.is_license_text so it preserves whether any matched lic_item
is license text instead of overwriting the flag per item. Use this aggregate
value both for result_item.is_license_text and the
filter_fsf_copyright_from_gpl_license_text call, and add a regression test
covering multiple license items in differing orders.
🪄 Autofix

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 Plus

Run ID: cd6b2a76-a679-4b32-b2c4-bea5282f5dfa

📥 Commits

Reviewing files that changed from the base of the PR and between 8149292 and cd30983.

📒 Files selected for processing (2)
  • src/fosslight_source/_parsing_scancode_file_item.py
  • tests/test_tox.py

Comment thread src/fosslight_source/_parsing_scancode_file_item.py
OR-combine matched_rule.is_license_text so FSF copyright filtering no longer depends on the last license item order.
@soimkim
soimkim merged commit ea89cbf into main Aug 10, 2026
6 of 8 checks passed
@soimkim
soimkim deleted the fix/fsf_copyright_remove branch August 10, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix [PR] Fix the bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants