Initial Commit
This commit is contained in:
22
pre-commit-todos/pre-commit
Executable file
22
pre-commit-todos/pre-commit
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Pre commit hook that Warns about code being commited.
|
||||
# Add unwanted code to the WARNING array as necessary
|
||||
WARNING=( "TODO-WARN:" )
|
||||
for i in "${WARNING[@]}"
|
||||
do
|
||||
git diff --cached --name-only | \
|
||||
GREP_COLOR='7;4;37;41' xargs grep --color --with-filename -n $i
|
||||
done
|
||||
|
||||
# Pre commit hook that prevents FORBIDDEN code from being commited.
|
||||
# Add unwanted code to the FORBIDDEN array as necessary
|
||||
FORBIDDEN=( "TODO:" )
|
||||
for i in "${FORBIDDEN[@]}"
|
||||
do
|
||||
git diff --cached --name-only | \
|
||||
GREP_COLOR='4;5;37;41' xargs grep --color --with-filename -n $i && \
|
||||
echo 'COMMIT REJECTED Found' $i 'references. Please remove them before commiting' && exit 1
|
||||
done
|
||||
|
||||
exit $ERR
|
Reference in New Issue
Block a user