Skip to content

chore(lint): stamp license headers with the current year#246

Open
behinddwalls wants to merge 1 commit into
mainfrom
preetam/licenseheader-year
Open

chore(lint): stamp license headers with the current year#246
behinddwalls wants to merge 1 commit into
mainfrom
preetam/licenseheader-year

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Why?

The license-header linter pinned the copyright year to a hardcoded 2025 constant and required an exact match, so any file authored in a later year would need a manual constant bump — and bumping it would retroactively fail every existing file.

What?

The header is now validated by pattern: the copyright line matches // Copyright (c) <YYYY> Uber Technologies, Inc. for any 4-digit year, while the rest of the block must match exactly. The -fix mode stamps time.Now().Year(), so new files get the current year automatically with no future edits. Existing files (all 2025) keep passing. Added test cases covering an older year, a wrong company, and a non-numeric year.

Test Plan

bazel test //tool/linter/licenseheader:licenseheader_test
bazel run //tool/linter/licenseheader -- -check (whole repo still clean)

@behinddwalls behinddwalls marked this pull request as ready for review June 15, 2026 22:45
@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners June 15, 2026 22:45
@behinddwalls behinddwalls added this pull request to the merge queue Jun 15, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 15, 2026
## Summary

### Why?

The license-header linter pinned the copyright year to a hardcoded `2025` constant and required an exact match, so any file authored in a later year would need a manual constant bump — and bumping it would retroactively fail every existing file.

### What?

The header is now validated by pattern: the copyright line matches `// Copyright (c) <YYYY> Uber Technologies, Inc.` for any 4-digit year, while the rest of the block must match exactly. The `-fix` mode stamps `time.Now().Year()`, so new files get the current year automatically with no future edits. Existing files (all `2025`) keep passing. Added test cases covering an older year, a wrong company, and a non-numeric year.

## Test Plan

✅ `bazel test //tool/linter/licenseheader:licenseheader_test`
✅ `bazel run //tool/linter/licenseheader -- -check` (whole repo still clean)
@behinddwalls behinddwalls force-pushed the preetam/licenseheader-year branch from 98bd7cb to 7cf1f8a Compare June 16, 2026 03:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants