Update copyright year with a precommit hook #1514
Open
+71
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is hard to remember that the copyright year should be updated when there are changes to files. This modifies our existing SPDX pre-commit hook to fix the latest copyright year.
Locally, the pre-commit hook only runs on modified files, and we explicitly do not want to do a mass update of every file, especially ones that haven't changed in a while.
HOWEVER, since the pre-commit CI check runs on every file, it does require that every file is compliant with the rule, which is why there is an update of many files here. It shows how many files we have forgotten to update in the past -- but once we do this mass update we should never have to do another one going forward since this rule will help us remember.
EDIT: There is actually a really hilarious cyclical problem with doing it that way. You can ask it to update the copyright years based on the last known commit. But that creates a commit in this year, so it will immediately want to update to this year. I don't think that's the behavior we want, so I've modified this to only check the last year on /staged/ files. It means the year check doesn't actually run as part of CI, but I think that's fine. And it means no mass updating of files at this time -- just correctness going forward as things get naturally updated.