-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto-copyright for precommits (#732)
* Add auto-copyright for precommits * Add precommit modified files to gitignore --------- Signed-off-by: Ahmed Hussein (amahussein) <a@ahussein.me>
- Loading branch information
1 parent
5b49ced
commit 418c3e7
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,6 @@ target/ | |
|
||
# prepackage locations | ||
csp-resources* | ||
|
||
# precommit files | ||
*-E |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# 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. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
repos: | ||
- repo: local | ||
hooks: | ||
- id: auto-copyrighter | ||
name: Update copyright year | ||
entry: scripts/auto-copyrighter.sh | ||
language: script | ||
pass_filenames: true | ||
verbose: true | ||
- repo: https://github.com/pre-commit/pre-commit-hooks.git | ||
rev: v4.0.1 | ||
hooks: | ||
- id: check-added-large-files | ||
name: Check for file over 1.5MiB | ||
args: ['--maxkb=1500', '--enforce-all'] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# 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. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
|
||
SPARK_RAPIDS_AUTO_COPYRIGHTER=${SPARK_RAPIDS_AUTO_COPYRIGHTER:-OFF} | ||
|
||
case "$SPARK_RAPIDS_AUTO_COPYRIGHTER" in | ||
|
||
OFF) | ||
echo "Copyright updater is DISABLED. Automatic Copyright Updater can be enabled/disabled by setting \ | ||
SPARK_RAPIDS_AUTO_COPYRIGHTER=ON or SPARK_RAPIDS_AUTO_COPYRIGHTER=OFF, \ | ||
correspondingly" | ||
exit 0 | ||
;; | ||
|
||
ON) | ||
;; | ||
|
||
*) | ||
echo "Invalid value of SPARK_RAPIDS_AUTO_COPYRIGHTER=$SPARK_RAPIDS_AUTO_COPYRIGHTER. | ||
Only ON or OFF are allowed" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
set -x | ||
echo "$@" | xargs -L1 sed -i -E \ | ||
"s/Copyright *\(c\) *([0-9,-]+)*-([0-9]{4}), *NVIDIA *CORPORATION/Copyright (c) \\1-`date +%Y`, NVIDIA CORPORATION/; /`date +%Y`/! s/Copyright *\(c\) ([0-9]{4}), *NVIDIA *CORPORATION/Copyright (c) \\1-`date +%Y`, NVIDIA CORPORATION/" |