Add check-copyright-date pre-commit hook.
Is this a good idea? Please leave a comment (and subscribe to my channel!)
Migrated from D3191 (view on Phabricator)
Merge request reports
Activity
Build is green
Patch application report for D3191 (id=11337)
Rebasing onto 3a612cca...
Current branch diff-target is up to date.
Changes applied before test
commit d3a7413082f5bb0ba11dd5acffedb45cdce92c1d Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu May 28 12:08:48 2020 +0200 Add check-copyright-date pre-commit hook.
See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/13/ for more details.
Build is green
Patch application report for D3191 (id=11338)
Rebasing onto 3a612cca...
Current branch diff-target is up to date.
Changes applied before test
commit 54e74edf4001c61d90eb7fc3b607fb4792b1eb71 Author: Valentin Lorentz <vlorentz@softwareheritage.org> Date: Thu May 28 12:08:48 2020 +0200 Add check-copyright-date pre-commit hook.
See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/14/ for more details.
Good idea, but unfortunately I think this will complain when running
pre-commit -a
, if a file hasn't seen an update recently. This would need to check whether the last year matches the last commit in git log for that file.If we always want all files to have copyright statements to the current year, we should make this check update the file automatically instead of just checking it (that way we can just do a mass-commit every year).
(Also, not all changes to a file warrant a copyright bump, but that's more of a theoretical concern).
! In !145 (closed), @olasd wrote: Good idea, but unfortunately I think this will complain when running
pre-commit -a
, if a file hasn't seen an update recently. This would need to check whether the last year matches the last commit in git log for that file.Oh, indeed :(
! In !145 (closed), @ardumont wrote: What will be the output of that pre-commit check (when it fails)?
It will just show as "Failed", with no error message.
We probably need to write an actual script instead of this inline thing, if we want an error message (and auto-fixing, and checking git logs)
mentioned in merge request swh-loader-git!39 (closed)
For the record, the Linux Foundation advises not specifying years in copyright notices. curl removed them in 2023. Some argues that only the first year should be kept.
Edited by Jérémy Bobbio (Lunar)
mentioned in issue swh/meta#4963