Skip to content

Conversation

@Kaushik-Kumar-CEG
Copy link

Fixes #4584

Description

This PR fixes an incorrect license detection in NumPy's dragon4.c, where the text "As a special exception" was incorrectly triggering a generic-exception match.

Changes:

  • Modified license-intro_8.RULE: Downgraded this rule from is_license_intro to is_license_clue. This ensures the phrase contributes to evidence but does not trigger a false positive when found alone.
  • Added false-positive_dragon4.RULE: Added a specific false positive rule to ignore the misleading text ("As a special exception the smallest normal value") found in dragon4.c.

Verification:

  • Reproduced the issue locally: confirmed generic-exception was originally detected.
  • Verified the fix: confirmed the detection is gone after the changes.
  • Validated the rule downgrade: confirmed that license-intro_8.RULE correctly behaves as a clue (no detection) when isolated.

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📄 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR (Verified fix locally)
  • Commits are in uniquely-named feature branch and has no merge conflicts 📂
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

- Change 'license-intro_8.RULE' to a license clue to prevent false positives.
- Add 'false-positive_dragon4.RULE' to ignore specific text in NumPy.

Fixes aboutcode-org#4584

Signed-off-by: Kaushik <kaushikrjpm10@gmail.com>
@Kaushik-Kumar-CEG
Copy link
Author

Hey @pombredanne @AyanSinhaMahapatra! I looked into the CI failure and ran the license tests locally to verify everything works:

Local test results:

  • pytest tests/licensedcode/test_detect.py -v → 55 passed ✅
  • pytest tests/licensedcode/ -v → 474 passed ✅

The failing test (test_scan_system_package_end_to_end_installed_win_reg) is for Windows Registry package detection, which is completely unrelated to this license fix for dragon4.c. The CI shows 3595 tests passed with only this 1 unrelated failure.

All license tests pass successfully, so the fix is working correctly without breaking existing functionality. Let me know if you need anything else!

Signed-off-by: Kaushik <kaushikrjpm10@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect license detection

1 participant