Skip to content

Comments

Add patent scan plugin with CLI support and extended detection tests#4763

Open
dikshaa2909 wants to merge 2 commits intoaboutcode-org:developfrom
dikshaa2909:feature/patent-detection-4510
Open

Add patent scan plugin with CLI support and extended detection tests#4763
dikshaa2909 wants to merge 2 commits intoaboutcode-org:developfrom
dikshaa2909:feature/patent-detection-4510

Conversation

@dikshaa2909
Copy link

Fixes #4510

Summary

This PR adds a new Patent Scan Plugin to detect patent references and patent numbers in scanned files.

The implementation follows existing ScanCode plugin architecture and integrates with the CLI, API, and JSON output.


Features

  • New CLI flag: --patent
  • Threshold option: --max-patent (default: 50, 0 for no limit)
  • Detection of:
    • Patent numbers (US, EP, WO, JP, CN, KR, GB, IN)
    • Formats like:
      • US Patent 8,123,456 B2
      • US20190012345A1
      • EP1234567B1
      • WO 2019/123456
    • Patent keywords:
      • patent pending
      • patented
      • patent application
      • patent number
  • Word-boundary checks to avoid false positives (e.g., unpatented)
  • Deduplication and threshold enforcement
  • Structured output under patent_detections

Implementation

  • Detection logic: src/cluecode/patents.py
  • CLI plugin: src/cluecode/plugin_patent.py
  • API integration: get_patents() in scancode.api
  • Registered via setup.cfg

Tests

Added tests covering:

  • Basic detection
  • International formats
  • Keyword detection
  • No false positives
  • Threshold behavior

Tests pass locally and in Docker.


Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled and linked to issue
  • Tests pass locally
  • Feature branch used
  • Updated documentation (if required)
  • Updated CHANGELOG (if required)

Signed-off-by: dikshaa2909 dikshadeware@gmail.com

Signed-off-by: dikshaa2909 <dikshadeware@gmail.com>
Signed-off-by: dikshaa2909 <dikshadeware@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.

Also detect possible patent issues or references

1 participant