-
Notifications
You must be signed in to change notification settings - Fork 5
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
verify-copyright disallows an update that makes years match file history for a new file #48
Comments
It comes from here: pre-commit-hooks/src/rapids_pre_commit_hooks/copyright.py Lines 246 to 248 in 5d453f2
We enable |
I'd be open to making |
Oh wow, thank you! Ok yeah If I add any content to that file to make it arbitrarily different from the others in the repo, like a comment that says sed -i .bak 's/2023-2024/2024/g' ./python/libcudf/libcudf/_version.py
echo "# libcudf" >> ./python/libcudf/libcudf/_version.py
git add ./python/libcudf/libcudf/_version.py
git diff branch-24.10 diff --git a/python/libcudf/libcudf/_version.py b/python/libcudf/libcudf/_version.py
index 7dd732b490..8e8df732b3 100644
--- a/python/libcudf/libcudf/_version.py
+++ b/python/libcudf/libcudf/_version.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2023-2024, NVIDIA CORPORATION.
+# Copyright (c) 2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -31,3 +31,4 @@ except FileNotFoundError:
__git_commit__ = ""
__all__ = ["__git_commit__", "__version__"]
+# libcudf ... , the hook lets me change the year to just 2024. pre-commit run verify-copyright
However... it will also let me change the file and leave the years unchanged. echo "# libcudf" >> ./python/libcudf/libcudf/_version.py
git add ./python/libcudf/libcudf/_version.py
git diff branch-24.10 diff --git a/python/libcudf/libcudf/_version.py b/python/libcudf/libcudf/_version.py
index 7dd732b490..3a29041009 100644
--- a/python/libcudf/libcudf/_version.py
+++ b/python/libcudf/libcudf/_version.py
@@ -31,3 +31,4 @@ except FileNotFoundError:
__git_commit__ = ""
__all__ = ["__git_commit__", "__version__"]
+# libcudf pre-commit run verify-copyright
That's a kind of interesting quirk of this. It means that for the same file and commit history, there are multiple different sets of years that the hook will accept as valid (in this case, both |
This is also intentional. The hook doesn't know when the file was created (it may have history outside of the repo), only that it was introduced in 2024 and should have its latest year updated. |
Ok, got it. I understand now how both could be justifiable year ranges for this file. I'm convinced that this isn't a bug but really just subtle behavior that surprised me because I didn't know about the
I think this would be helpful. In this example, this file's content was intentionally identical to the content of other files in the repo, so sharing a range of copyright dates could make sense. In other cases, two files might end up just being accidentally identical (I'm thinking like a dot file configuring some CI tool, or an With an error message similar to this:
|
Description
See rapidsai/cudf#15483 (comment).
There, I observed a case where a totally new file (not moved, not modified) was initially committed in April 2024 with a copyright header like this:
When I tried to change it to just 2024,
verify-copyright
refused to let me.Relevant details:
branch-24.10
Reproducible Example
This came up on a PR, but I can reproduce it without any forks or PRs involved, now that rapidsai/cudf#15483 has been merged.
History from https://github.com/rapidsai/cudf/commits/branch-24.10/python/libcudf/libcudf/_version.py
Notes
I (@jameslamb) am actively investigating this. Just putting this up to track the work.
The text was updated successfully, but these errors were encountered: