-
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
Add copyright check #9
Conversation
be30991
to
3ac9bef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Initial pass -- these comments may be outdated by the latest changes.)
At this point, the code looks good and I just need to spend time testing before I approve. |
This failed for me when I tested this hook on cudf. I got a diff --git a/src/rapids_pre_commit_hooks/lint.py b/src/rapids_pre_commit_hooks/lint.py
index edb1f93..4f8ea9c 100644
--- a/src/rapids_pre_commit_hooks/lint.py
+++ b/src/rapids_pre_commit_hooks/lint.py
@@ -210,7 +210,10 @@ class ExecutionContext(contextlib.AbstractContextManager):
for file in self.args.files:
with open(file) as f:
- content = f.read()
+ try:
+ content = f.read()
+ except UnicodeDecodeError:
+ pass
linter = Linter(file, content)
for check in self.checks: |
I'll open a separate PR for that. Edit: #10 |
bd8128f
to
175b5dc
Compare
Fixes: rapidsai#2
175b5dc
to
cf900c4
Compare
I tried testing this hook on cuspatial. That repo doesn't have any automated enforcement of copyrights today, so many of its files are outdated. I tried editing some files, and the copyright script appeared to work as intended. However, I am not sure what options I can provide to get this repo "up to date." There are a lot of files that were modified in past PRs in 2023 and 2024 but those changes aren't reflected in the copyright dates because this repo had no copyright year header enforcement. It seems like this hook might provide eventual consistency after every file is modified, but I want to batch-process the existing files and get them caught up so that the copyrights on Testing PR here: rapidsai/cuspatial#1328 |
Is it really essential to correct cuSpatial? Seems to me "eventual consistency" is good enough. |
I would accept eventual consistency if a bulk update is impossible, but I want to make sure I'm understanding the scope and capabilities of this tool correctly. I think it would be reasonable for this kind of bulk update to be in scope, too, and it shouldn't be very complex if my understanding is correct. |
Right now the script does "update all files with the current year that have been modified since the merge-base with the target branch." The batch use case is "update all files with the year they were last modified at any point in their Git history." The script does not do this in its current state. It is definitely possible, and I'd be happy to do it, but it will require a fair amount of rework. We will have to trace the history of each file, including through copies and renames. Let's get this first iteration merged first, and then we can do that as a follow-up. Edit: I added this feature to this PR. You can try it with the |
I just ran |
cuspatial (570 files, 2006 commits) completed in 13 seconds (88,000 file-commits per second.) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few final comments, but overall I think this is really close. I approve. Feel free to iron out any details and ask for more feedback if you want it, but feel free to merge when you're ready and we can start to migrate RAPIDS to using this hook.
Fixes: #2