2022-08-22 09:55:08 +04:00
|
|
|
failed=''
|
2022-07-01 14:28:39 +04:00
|
|
|
|
2022-07-01 09:36:52 +04:00
|
|
|
title () {
|
2022-07-01 14:28:39 +04:00
|
|
|
|
|
|
|
RESET='\033[0m'
|
|
|
|
COLOR='\033[1;36m'
|
|
|
|
|
2022-07-01 09:36:52 +04:00
|
|
|
echo
|
2022-07-01 14:28:39 +04:00
|
|
|
echo -e "$COLOR[#] $1$RESET"
|
|
|
|
}
|
|
|
|
|
|
|
|
error_msg () {
|
|
|
|
|
|
|
|
RESET='\033[0m'
|
|
|
|
OK='\033[1;32m'
|
|
|
|
ERR='\033[1;31m'
|
|
|
|
|
|
|
|
if (( $1 )); then
|
2022-08-22 09:55:08 +04:00
|
|
|
failed+="$2, "
|
2022-07-01 14:28:39 +04:00
|
|
|
echo -e "$ERR[X] Found errors$RESET"
|
|
|
|
else
|
|
|
|
echo -e "$OK[V] Passed successfully$RESET"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
display_failed() {
|
|
|
|
|
|
|
|
RESET='\033[0m'
|
|
|
|
FAILED='\033[1;33m'
|
|
|
|
SUCCESS='\033[1;32m'
|
|
|
|
|
2022-08-22 09:55:08 +04:00
|
|
|
if [[ $failed != '' ]]; then
|
|
|
|
joined=`echo -n "$failed" | sed 's/, $//'`
|
2022-07-01 19:02:10 +04:00
|
|
|
echo -e "$FAILED[!] View output of: $joined$RESET"
|
2022-07-01 14:28:39 +04:00
|
|
|
else
|
2022-08-22 09:55:08 +04:00
|
|
|
echo -e "$SUCCESS[V] All checks are passed successfully$RESET"
|
2022-07-01 14:28:39 +04:00
|
|
|
fi
|
2022-07-01 09:36:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
title 'Checking needed modules...'
|
|
|
|
pip install pycodestyle mypy pylint
|
|
|
|
|
|
|
|
title 'Running unit tests...'
|
|
|
|
python -m unittest discover -v ./tests
|
2022-07-01 14:28:39 +04:00
|
|
|
error_msg $? 'unittest'
|
2022-07-01 09:36:52 +04:00
|
|
|
|
|
|
|
title 'Running pep8 checker...'
|
|
|
|
python -m pycodestyle .
|
2022-07-01 14:28:39 +04:00
|
|
|
error_msg $? 'pep8'
|
2022-07-01 09:36:52 +04:00
|
|
|
|
|
|
|
title 'Running mypy checker...'
|
|
|
|
python -m mypy .
|
2022-07-01 14:28:39 +04:00
|
|
|
error_msg $? 'mypy'
|
|
|
|
|
|
|
|
title 'Running pylint checker...'
|
|
|
|
python -m pylint ./python_aternos
|
|
|
|
error_msg $? 'pylint'
|
|
|
|
|
|
|
|
display_failed
|
|
|
|
echo
|