pre-commit-hooks
pre-commit-hooks copied to clipboard
When copyright year changes, insert-license simply puts new copy of whole license file at the top.
Currently doing this:
diff --git a/foo b/foo
index daf7c00..c1b0299 100644
--- a/foo
+++ b/foo
@@ -1,3 +1,7 @@
+// Copyright (c) 2022 by Foo Inc.
+// Confidential and proprietary, see LICENSE for details.
+// SPDX-License-Identifier: LicenseRef-Foo-Internal-Only
+
// Copyright (c) 2021 by Foo Inc.
// Confidential and proprietary, see LICENSE for details.
// SPDX-License-Identifier: LicenseRef-Foo-Internal-Only
Would be preferable to allow for the detection of year change and only change that part.
Based on https://reuse.software/faq/#years-copyright , This would need to detect either a single year, or a range of years.
Reading the docs I'm wondering if I leave the --remove-header enabled in the pre-commit cfg if that will just work.
Hi @kevbroch
I think the documentation you mentioned is quite explicit indeed.
And no, I don't think keeping the --remove-header option always set will work as you wish.
You need to perform the steps detailed in the doc whenever LICENSE.txt is edited
Thanks for the confirmation.
For my use case, of only updating the license header year if/when the file is edited for other reasons, I'll need to figure out some other method to automatically update those changed files.
Alright. Can I close this issue then ?
It's up to you. I'll hopefully submit a PR adding the --update-year feature. If/when that happens I can always reference this issue for completeness.
I’m not a lawyer, so don’t take this as legal advice from me. IIUC, you don't need to update the copyright year on license declarations.
See also https://hynek.me/til/copyright-years/
This feature has been implemented by @aostrowski in #59