You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
catcli/tests.sh

107 lines
2.0 KiB
Bash

6 years ago
#!/bin/sh
# author: deadc0de6 (https://github.com/deadc0de6)
# Copyright (c) 2017, deadc0de6
3 years ago
cur=$(dirname "$(readlink -f "${0}")")
6 years ago
# stop on first error
1 year ago
set -e
#set -v
6 years ago
1 year ago
# pycodestyle
echo "[+] pycodestyle"
2 years ago
pycodestyle --version
1 year ago
pycodestyle catcli/
6 years ago
pycodestyle tests/
1 year ago
pycodestyle setup.py
5 years ago
1 year ago
# pyflakes
echo "[+] pyflakes"
2 years ago
pyflakes --version
5 years ago
pyflakes catcli/
pyflakes tests/
1 year ago
pyflakes setup.py
5 years ago
1 year ago
# pylint
2 years ago
# R0914: Too many local variables
# R0913: Too many arguments
# R0912: Too many branches
# R0915: Too many statements
2 years ago
# R0911: Too many return statements
2 years ago
# R0903: Too few public methods
1 year ago
# R0902: Too many instance attributes
1 year ago
# R0201: no-self-used
1 year ago
echo "[+] pylint"
2 years ago
pylint --version
1 year ago
pylint -sn \
2 years ago
--disable=R0914 \
--disable=R0913 \
--disable=R0912 \
--disable=R0915 \
2 years ago
--disable=R0911 \
2 years ago
--disable=R0903 \
1 year ago
--disable=R0902 \
1 year ago
--disable=R0201 \
--disable=R0022 \
2 years ago
catcli/
1 year ago
# R0801: Similar lines in 2 files
# W0212: Access to a protected member
# R0914: Too many local variables
# R0915: Too many statements
1 year ago
pylint -sn \
1 year ago
--disable=R0801 \
2 years ago
--disable=W0212 \
--disable=R0914 \
--disable=R0915 \
tests/
1 year ago
pylint -sn setup.py
2 years ago
1 year ago
# mypy
echo "[+] mypy"
4 months ago
mypy --version
4 months ago
mypy --config-file=.mypy.ini catcli/
1 year ago
3 months ago
# pytype
echo "[+] pytype"
pytype --version
pytype catcli/
set +e
grep -R 'TODO' catcli/ && echo "TODO found" && exit 1
grep -R 'FIXME' catcli/ && echo "FIXME found" && exit 1
set -e
1 year ago
# unittest
echo "[+] unittests"
4 months ago
mkdir -p coverages/
coverage run -p --data-file coverages/coverage -m pytest tests
3 years ago
1 year ago
# tests-ng
echo "[+] tests-ng"
for t in "${cur}"/tests-ng/*.sh; do
echo "running test \"$(basename "${t}")\""
3 years ago
${t}
done
3 years ago
1 year ago
# check shells
echo "[+] shellcheck"
1 year ago
if ! command -v shellcheck >/dev/null 2>&1; then
1 year ago
echo "Install shellcheck"
exit 1
fi
shellcheck --version
find . -iname '*.sh' | while read -r script; do
shellcheck -x \
--exclude SC2002 \
1 year ago
"${script}"
done
# merge coverage
echo "[+] coverage merge"
4 months ago
coverage combine coverages/*
coverage xml
1 year ago
echo "ALL TESTS DONE OK"
3 years ago
exit 0