Skip to content

Fix incorrect license detection in dragon4.c - #4654

Open
Kaushik-Kumar-CEG wants to merge 2 commits into
aboutcode-org:developfrom
Kaushik-Kumar-CEG:fix-issue-4584
Open

Fix incorrect license detection in dragon4.c#4654
Kaushik-Kumar-CEG wants to merge 2 commits into
aboutcode-org:developfrom
Kaushik-Kumar-CEG:fix-issue-4584

Conversation

@Kaushik-Kumar-CEG

@Kaushik-Kumar-CEG Kaushik-Kumar-CEG commented Dec 30, 2025

Copy link
Copy Markdown

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)

@Kaushik-Kumar-CEG
Kaushik-Kumar-CEG force-pushed the fix-issue-4584 branch 2 times, most recently from 4b4cfb7 to c0a80f5 Compare January 6, 2026 11:49
@Kaushik-Kumar-CEG
Kaushik-Kumar-CEG force-pushed the fix-issue-4584 branch 2 times, most recently from 9180bfd to 55ff6f1 Compare January 18, 2026 18:06
@Kaushik-Kumar-CEG

Kaushik-Kumar-CEG commented Jan 18, 2026

Copy link
Copy Markdown
Author

@pombredanne @AyanSinhaMahapatra

This PR resolves the false positive generic-exception detection in dragon4.c. Verified the fix, it works locally.

All checks have passed

Ready for your review!

@pombredanne

Copy link
Copy Markdown
Member

Thanks! This is overall looking good. Can you add two detection tests (one for the false positive and one for the clue?)

- 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>
Signed-off-by: Kaushik <kaushikrjpm10@gmail.com>
@Kaushik-Kumar-CEG

Copy link
Copy Markdown
Author

Thanks! This is overall looking good. Can you add two detection tests (one for the false positive and one for the clue?)
@pombredanne

I have added two necessary detection tests :

  1. False positive test for dragon4.c - verifies no incorrect detection
Screenshot 2026-01-20 095217
  1. Clue test for license-intro_8 - verifies rule behaves as clue
Screenshot 2026-01-20 095354

I have attached the results for both these tests as images (terminal outputs).
Ready for your review!

@Kaushik-Kumar-CEG

Copy link
Copy Markdown
Author

@pombredanne
I have added two necessary detection tests as per your review
Please let me know if there are any further changes :)

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

2 participants