Add linting pre-commit hook and hook install script (#86)
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
Co-authored-by: Justin Chung <20733699+justin13888@users.noreply.github.com> Co-authored-by: Max Erenberg <merenber@csclub.uwaterloo.ca> Reviewed-on: #86 Reviewed-by: Max Erenberg <merenber@csclub.uwaterloo.ca> Co-authored-by: Justin Chung <j24chung@csclub.uwaterloo.ca> Co-committed-by: Justin Chung <j24chung@csclub.uwaterloo.ca>
This commit is contained in:
parent
010937ea17
commit
968f0815c7
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
docker run --rm -v "$PWD:$PWD:z" -w "$PWD" python:3.9-bullseye sh -c './lint-docker.sh'
|
||||
|
||||
exit $?
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Install pre-configured git hooks
|
||||
git config --local core.hooksPath .githooks/
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
. venv/bin/activate
|
||||
|
||||
echo -e "\nLinting Python files with Flake8:\n"
|
||||
|
||||
flake8
|
||||
PASS=$?
|
||||
|
||||
echo -e "\nPython linting complete!\n"
|
||||
|
||||
if [ "$PASS" -eq 0 ]; then
|
||||
echo -e "\033[42mCOMMIT SUCCEEDED\033[0m\n"
|
||||
exit $?
|
||||
else
|
||||
echo -e "\033[41mCOMMIT FAILED:\033[0m Your commit contains files that should pass flake8 but do not. Please fix the flake8 errors and try again.\n"
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue