Skip to content

Fix detection of copyright statements without year in copyright declarations#4757

Open
dikshaa2909 wants to merge 1 commit intoaboutcode-org:developfrom
dikshaa2909:fix-holder-only-copyright-detection
Open

Fix detection of copyright statements without year in copyright declarations#4757
dikshaa2909 wants to merge 1 commit intoaboutcode-org:developfrom
dikshaa2909:fix-holder-only-copyright-detection

Conversation

@dikshaa2909
Copy link

Fixes #4722

Description

This PR fixes detection of copyright statements that do not include a year in the declaration.

Previously, ScanCode required a year to be present alongside the copyright keyword. As a result, valid copyright statements such as:

  • Copyright The OpenTelemetry Authors
  • (c) The OpenTelemetry Authors

were not detected.

This update adjusts the copyright detection grammar to allow copyright declarations without a year component, while preserving existing behavior for statements that include years.

After this change, such statements are correctly identified and extracted.


How to Reproduce (Before Fix)

Example file:

// Copyright The OpenTelemetry Authors

Run:

./scancode --json-pp result.json -c version.go

Previously returned:

"copyrights": []

After This Fix

The same scan now correctly detects:

{
  "copyright": "Copyright The OpenTelemetry Authors"
}

Notes

  • Only the copyright detection logic was updated.
  • No unrelated files were modified.
  • Existing detection behavior for copyright statements with years remains unchanged.

Checklist

  • Reviewed contribution guidelines
  • PR is descriptively titled and links the original issue
  • Tests pass
  • Commits are in a uniquely named feature branch and have no merge conflicts
  • Documentation update not required
  • CHANGELOG update not required unless requested

@dikshaa2909 dikshaa2909 force-pushed the fix-holder-only-copyright-detection branch from c7ee2eb to 41656e7 Compare February 17, 2026 18:02
Signed-off-by: dikshaa2909 <dikshadeware@gmail.com>
@dikshaa2909 dikshaa2909 force-pushed the fix-holder-only-copyright-detection branch from 41656e7 to f3fad13 Compare February 17, 2026 18:58
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.

Copyrights not detected if year is missing from (c) or Copyright declaration

1 participant

Comments