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

Add copyright check #9

Merged
merged 24 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a9fb712
Add copyright check
KyleFromNVIDIA Jan 18, 2024
f2016f4
Add support for non-repos and repos with no commits
KyleFromNVIDIA Jan 22, 2024
1b3b78e
Fix issue with new files
KyleFromNVIDIA Jan 22, 2024
3509fe4
Update with review feedback
KyleFromNVIDIA Jan 22, 2024
dc8f6f3
Explain get_target_branch() more thoroughly
KyleFromNVIDIA Jan 22, 2024
a7e190f
Update order of environment variables
KyleFromNVIDIA Jan 22, 2024
958d089
Add configuration option to warning message
KyleFromNVIDIA Jan 22, 2024
78214e8
More review feedback
KyleFromNVIDIA Jan 22, 2024
dfd944c
Use max() instead of sorted()
KyleFromNVIDIA Jan 22, 2024
cf900c4
Fix warning in test
KyleFromNVIDIA Jan 22, 2024
8eb6814
Add --target-branch argument, update help
KyleFromNVIDIA Jan 23, 2024
f901713
Use max() instead of sorted()
KyleFromNVIDIA Jan 23, 2024
e4be581
Factor out helper methods from apply_copyright_check()
KyleFromNVIDIA Jan 23, 2024
07c45b4
zip(strict=True)
KyleFromNVIDIA Jan 23, 2024
2c6061a
More refactoring
KyleFromNVIDIA Jan 23, 2024
2ea13fa
Make warnings RuntimeWarnings
KyleFromNVIDIA Jan 23, 2024
dc4fb6c
Add ability to update files to last modified date
KyleFromNVIDIA Jan 23, 2024
b42bb4f
Fix regexes
KyleFromNVIDIA Jan 23, 2024
5770735
Drastically speed up find_blob()
KyleFromNVIDIA Jan 23, 2024
2a72769
Normalize Git paths
KyleFromNVIDIA Jan 24, 2024
2011a2b
Add verify-copyright-batch pre-commit hook
KyleFromNVIDIA Jan 24, 2024
8bd1b4a
Remove verify-copyright-batch, change name
KyleFromNVIDIA Jan 26, 2024
1b55d64
Simplify last modified logic at expense of smart change detection
KyleFromNVIDIA Jan 26, 2024
0e823c5
Fix test
KyleFromNVIDIA Jan 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,31 @@
language: python
types: [shell]
args: [--fix]
- id: verify-copyright
name: copyright headers
KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
description: make sure copyright headers are up to date
entry: verify-copyright
language: python
files: |
(?x)
[.](cmake|cpp|cu|cuh|h|hpp|sh|pxd|py|pyx)$|
CMakeLists[.]txt$|
CMakeLists_standalone[.]txt$|
meta[.]yaml$|
pyproject[.]toml$|
setup[.]cfg$
args: [--fix]
- id: verify-copyright-batch
KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
name: copyright headers
KyleFromNVIDIA marked this conversation as resolved.
Show resolved Hide resolved
description: make sure copyright headers are up to date in Git history
entry: verify-copyright
language: python
files: |
(?x)
[.](cmake|cpp|cu|cuh|h|hpp|sh|pxd|py|pyx)$|
CMakeLists[.]txt$|
CMakeLists_standalone[.]txt$|
meta[.]yaml$|
pyproject[.]toml$|
setup[.]cfg$
args: [--batch, --fix]
4 changes: 2 additions & 2 deletions ci/build-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

set -ue

pip install build pytest
pip install build

python -m build .

for PKG in dist/*; do
echo "$PKG"
pip uninstall -y rapids-pre-commit-hooks
pip install "$PKG"
pip install "$PKG[test]"
pytest
done
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,18 @@ classifiers = [
requires-python = ">=3.9"
dependencies = [
"bashlex",
"gitpython",
]

[project.optional-dependencies]
dev = [
test = [
"freezegun",
"pytest",
]

[project.scripts]
verify-conda-yes = "rapids_pre_commit_hooks.shell.verify_conda_yes:main"
verify-copyright = "rapids_pre_commit_hooks.copyright:main"

[tool.setuptools]
packages = { "find" = { where = ["src"] } }
Expand Down
Loading