run mypy during package build

This commit is contained in:
Benjamin Drung 2025-12-03 14:54:54 +01:00
parent 32530e356d
commit ee87f312bf
4 changed files with 15 additions and 1 deletions

2
debian/control vendored
View File

@ -18,6 +18,7 @@ Build-Depends:
flake8,
isort <!nocheck>,
lsb-release,
mypy <!nocheck>,
pylint <!nocheck>,
python3-all,
python3-apt,
@ -30,6 +31,7 @@ Build-Depends:
python3-pytest,
python3-requests <!nocheck>,
python3-setuptools,
python3-typeshed <!nocheck>,
python3-yaml <!nocheck>,
Standards-Version: 4.7.2
Vcs-Git: https://git.launchpad.net/ubuntu-dev-tools

2
debian/rules vendored
View File

@ -3,7 +3,7 @@
override_dh_auto_clean:
dh_auto_clean
rm -f .coverage
rm -rf .tox
rm -rf .mypy_cache .tox
override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))

View File

@ -4,3 +4,7 @@ line-length = 99
[tool.isort]
line_length = 99
profile = "black"
[tool.mypy]
disallow_incomplete_defs = true
ignore_missing_imports = true

View File

@ -21,6 +21,12 @@ run_flake8() {
flake8 --max-line-length=99 --ignore=E203,W503 . $PYTHON_SCRIPTS
}
run_mypy() {
echo "Running mypy..."
mypy .
mypy --scripts-are-modules $PYTHON_SCRIPTS
}
run_pylint() {
echo "Running pylint..."
pylint "$@" $(find * -name '*.py') $PYTHON_SCRIPTS
@ -31,10 +37,12 @@ if test "${1-}" = "--errors-only"; then
run_black || true
run_isort || true
run_flake8 || true
run_mypy
run_pylint --errors-only
else
run_black
run_isort
run_flake8
run_mypy
run_pylint
fi