From 9f8d749523df37b64a2b634ee1c43773ecede8f2 Mon Sep 17 00:00:00 2001 From: Matthew Schinckel Date: Sun, 9 Sep 2018 22:01:01 +0930 Subject: [PATCH 1/2] Test using mypy and bandit. mypy does static analysis, and bandit does security auditing (of known vulnerabilities, and some suspect coding patterns). Both of these are currently showing some errors, which should be addressed, and some warnings, which could be addressed. --- .gitignore | 1 + tox.ini | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index d9bc97cf..1819bc1c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ _mailinglist .idea __pycache__ .pytest_cache/ +.mypy_cache/* .tox/ .venv venv/ diff --git a/tox.ini b/tox.ini index d14d66d2..eda6d20e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py35, py36, docs, lint, pylint +envlist = py35, py36, docs, lint, pylint, mypy, bandit skip_missing_interpreters = True [testenv] @@ -54,3 +54,20 @@ commands = flake8 pyhap tests --select=D10,D205,D4,E501 pylint pyhap --disable=all --enable=missing-docstring,empty-docstring # pydocstyle pyhap tests + + +[testenv:mypy] +basepython = {env:PYTHON3_PATH:python3} +deps = + -r{toxinidir}/requirements_all.txt + mypy +commands = + mypy --ignore-missing-imports pyhap + + +[testenv:bandit] +basepython = {env:PYTHON3_PATH:python3} +deps = + bandit +commands = + bandit -r pyhap From e3645c39203be86ce8e8ca65c1b0af72f1b43669 Mon Sep 17 00:00:00 2001 From: Matthew Schinckel Date: Sun, 9 Sep 2018 22:24:17 +0930 Subject: [PATCH 2/2] Force travis to run bandit/mypy tests. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2e3ad1ef..d501f1be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,10 @@ matrix: env: TOXENV=py36 - python: "3.6" env: TOXENV=docs + - python: "3.6" + env: TOXENV=bandit + - python: "3.6" + env: TOXENV=mypy before-install: - sudo apt-get -qq update - sudo apt-get install -y libavahi-compat-libdnssd-dev