Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kevbroch opened this issue Jan 18, 2022 · 7 comments

Comments

@kevbroch
Copy link

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
Copy link
Author

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

@Lucas-C
Copy link
Owner

Lucas-C commented Jan 19, 2022

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

@kevbroch
Copy link
Author

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.

@Lucas-C
Copy link
Owner

Lucas-C commented Jan 19, 2022

Alright. Can I close this issue then ?

@kevbroch
Copy link
Author

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.

@pradyunsg
Copy link

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/

aostrowski pushed a commit to aostrowski/lucas-c-pre-commit-hooks that referenced this issue Jan 18, 2023
The new flag `--flexible-years` allows automatically updating the year
in copyright headers, using always the current year when inserting new
ones and removing headers regardless of the years they contain.
aostrowski added a commit to aostrowski/lucas-c-pre-commit-hooks that referenced this issue Jan 22, 2023
The new flag `--use-current-year` allows automatically updating the year
in copyright headers, using always the current year when inserting new
ones and removing headers regardless of the years they contain.
@Lucas-C
Copy link
Owner

Lucas-C commented Jan 22, 2023

This feature has been implemented by @aostrowski in #59

@Lucas-C Lucas-C closed this as completed Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants