2
1
mirror of https://github.com/deadc0de6/catcli synced 2024-11-15 18:14:01 +00:00
catcli/tests.sh

94 lines
1.7 KiB
Bash
Raw Normal View History

2017-12-14 18:37:31 +00:00
#!/bin/sh
# author: deadc0de6 (https://github.com/deadc0de6)
# Copyright (c) 2017, deadc0de6
2021-10-16 15:18:14 +00:00
cur=$(dirname "$(readlink -f "${0}")")
2017-12-14 18:37:31 +00:00
# stop on first error
2023-03-07 21:37:29 +00:00
set -e
#set -v
2017-12-14 18:37:31 +00:00
2023-03-07 21:37:29 +00:00
# pycodestyle
echo "[+] pycodestyle"
2022-10-22 16:20:57 +00:00
pycodestyle --version
2023-03-08 20:38:46 +00:00
pycodestyle catcli/
2017-12-14 18:37:31 +00:00
pycodestyle tests/
2023-03-07 21:37:29 +00:00
pycodestyle setup.py
2019-02-16 12:35:33 +00:00
2023-03-07 21:37:29 +00:00
# pyflakes
echo "[+] pyflakes"
2022-10-22 16:20:57 +00:00
pyflakes --version
2019-02-16 12:35:33 +00:00
pyflakes catcli/
pyflakes tests/
2023-03-07 21:37:29 +00:00
pyflakes setup.py
2019-02-16 12:35:33 +00:00
2023-03-07 21:37:29 +00:00
# pylint
2022-10-20 20:01:37 +00:00
# R0914: Too many local variables
# R0913: Too many arguments
# R0912: Too many branches
# R0915: Too many statements
2022-10-21 21:06:46 +00:00
# R0911: Too many return statements
2022-10-22 16:20:57 +00:00
# R0903: Too few public methods
2023-03-05 15:00:36 +00:00
# R0902: Too many instance attributes
2023-03-07 07:54:22 +00:00
# R0201: no-self-used
2023-03-07 21:37:29 +00:00
echo "[+] pylint"
2022-10-22 16:20:57 +00:00
pylint --version
2023-03-07 21:37:29 +00:00
pylint -sn \
2022-10-20 20:01:37 +00:00
--disable=R0914 \
--disable=R0913 \
--disable=R0912 \
--disable=R0915 \
2022-10-21 21:06:46 +00:00
--disable=R0911 \
2022-10-22 16:20:57 +00:00
--disable=R0903 \
2023-03-05 15:00:36 +00:00
--disable=R0902 \
2023-03-07 07:54:22 +00:00
--disable=R0201 \
--disable=R0022 \
2022-10-20 20:01:37 +00:00
catcli/
2023-03-08 20:38:46 +00:00
# R0801: Similar lines in 2 files
# W0212: Access to a protected member
# R0914: Too many local variables
# R0915: Too many statements
2023-03-07 21:37:29 +00:00
pylint -sn \
2023-03-08 20:38:46 +00:00
--disable=R0801 \
2022-10-20 20:01:37 +00:00
--disable=W0212 \
--disable=R0914 \
--disable=R0915 \
tests/
2023-03-07 21:37:29 +00:00
pylint -sn setup.py
2022-01-15 13:41:45 +00:00
2023-03-07 21:37:29 +00:00
# mypy
echo "[+] mypy"
2023-03-08 20:38:46 +00:00
mypy --strict catcli/
2023-03-05 15:00:36 +00:00
2023-03-07 21:37:29 +00:00
# unittest
echo "[+] unittests"
coverage run -p -m pytest tests
2021-10-16 15:18:14 +00:00
2023-03-07 21:37:29 +00:00
# tests-ng
echo "[+] tests-ng"
for t in "${cur}"/tests-ng/*.sh; do
echo "running test \"$(basename "${t}")\""
2021-10-16 15:18:14 +00:00
${t}
done
2021-10-16 15:23:25 +00:00
2023-03-07 21:37:29 +00:00
# check shells
echo "[+] shellcheck"
2023-03-08 21:59:17 +00:00
if ! command -v shellcheck >/dev/null 2>&1; then
2023-03-07 21:37:29 +00:00
echo "Install shellcheck"
exit 1
fi
shellcheck --version
find . -iname '*.sh' | while read -r script; do
shellcheck -x \
2023-03-09 20:41:27 +00:00
--exclude SC2002 \
2023-03-07 21:37:29 +00:00
"${script}"
done
# merge coverage
echo "[+] coverage merge"
coverage combine
echo "ALL TESTS DONE OK"
2021-10-16 15:23:25 +00:00
exit 0