pre-commit-hooks icon indicating copy to clipboard operation
pre-commit-hooks copied to clipboard

When copyright year changes, insert-license simply puts new copy of whole license file at the top.

Open kevbroch opened this issue 3 years ago • 6 comments

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.

kevbroch avatar Jan 18 '22 21:01 kevbroch

Reading the docs I'm wondering if I leave the --remove-header enabled in the pre-commit cfg if that will just work.

kevbroch avatar Jan 18 '22 21:01 kevbroch

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

Lucas-C avatar Jan 19 '22 07:01 Lucas-C

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.

kevbroch avatar Jan 19 '22 19:01 kevbroch

Alright. Can I close this issue then ?

Lucas-C avatar Jan 19 '22 20:01 Lucas-C

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.

kevbroch avatar Jan 19 '22 23:01 kevbroch

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/

pradyunsg avatar Feb 11 '22 09:02 pradyunsg

This feature has been implemented by @aostrowski in #59

Lucas-C avatar Jan 22 '23 17:01 Lucas-C