Page MenuHomeSoftware Heritage

Add check-copyright-date pre-commit hook.
Changes PlannedPublic

Authored by vlorentz on May 28 2020, 12:10 PM.

Details

Reviewers
None
Group Reviewers
Reviewers
Summary

Is this a good idea? Please leave a comment (and subscribe to my channel!)

Diff Detail

Repository
rDCORE Foundations and core functionalities
Branch
check-copyright-date
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 12531
Build 19033: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 19032: arc lint + arc unit

Event Timeline

Build is green

Patch application report for D3191 (id=11337)

Rebasing onto 3a612cca29...

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 3a612cca29...

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.

lol at the description ;)

It seems to behave correctly.

What will be the output of that pre-commit check (when it fails)?

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 D3191#77776, @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 :(

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)