mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-24 20:41:32 +00:00
Add pylint pre-push hooks
This commit is contained in:
parent
7a670f37f2
commit
3fad818b2b
22
.git-hooks/apply_hooks.sh
Executable file
22
.git-hooks/apply_hooks.sh
Executable file
@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
set -o errtrace
|
||||||
|
shopt -s expand_aliases
|
||||||
|
|
||||||
|
[ "$(uname)" == "Darwin" ] && alias readlink="greadlink" || :
|
||||||
|
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
|
||||||
|
here="$(dirname "$(readlink -f "$0")")"
|
||||||
|
cd "${here}/../.git/hooks"
|
||||||
|
|
||||||
|
rm -f pre-push pre-commit || :
|
||||||
|
prepush_script="../../.git-hooks/pre-push.sh"
|
||||||
|
precommit_script="../../.git-hooks/pre-commit.sh"
|
||||||
|
[ -f "${prepush_script}" ] && ln -s "${prepush_script}" pre-push
|
||||||
|
[ -f "${precommit_script}" ] && ln -s "${precommit_script}" pre-commit
|
||||||
|
|
||||||
|
echo -e "\n${GREEN}Done! Hooks applied, you can start committing and pushing!${NC}\n"
|
18
.git-hooks/pre-push.sh
Executable file
18
.git-hooks/pre-push.sh
Executable file
@ -0,0 +1,18 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
set -o errtrace
|
||||||
|
shopt -s expand_aliases
|
||||||
|
|
||||||
|
RED='\033[0;31m'
|
||||||
|
GREEN='\033[0;32m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
|
||||||
|
echo -e "Running pylint...\n"
|
||||||
|
if pylint lib; then
|
||||||
|
echo -e "\n${GREEN}Pylint found no errors!${NC}\n"
|
||||||
|
else
|
||||||
|
echo -e "\n${RED}Pylint failed with errors${NC}\n"
|
||||||
|
exit 1
|
||||||
|
fi
|
@ -3,3 +3,9 @@
|
|||||||
ignored-modules = zmq
|
ignored-modules = zmq
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
disable = missing-docstring, too-few-public-methods, invalid-name
|
disable = missing-docstring, too-few-public-methods, invalid-name
|
||||||
|
|
||||||
|
[SIMILARITIES]
|
||||||
|
|
||||||
|
ignore-comments=yes
|
||||||
|
ignore-docstrings=yes
|
||||||
|
ignore-imports=yes
|
||||||
|
Loading…
Reference in New Issue
Block a user