From 1f75d6cfc6d53645cd05156b457112f943ce8758 Mon Sep 17 00:00:00 2001 From: Thorsten Sick Date: Wed, 23 Feb 2022 12:41:49 +0100 Subject: [PATCH] More agressive mypy --- Makefile | 4 ++-- mypy.ini | 13 +++++++++++++ requirements.txt | 2 +- tox.ini | 3 +++ 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 mypy.ini diff --git a/Makefile b/Makefile index 2906aeb..e570b69 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,8 @@ pylint: # Testing if types are used properly mypy: - mypy --strict-optional app/ + mypy --strict-optional app/ plugins/base/ # Fixing mypy file by file stepbystep: - mypy --strict-optional plugins/base/plugin_base.py plugins/base/machinery.py app/config.py plugins/base/caldera.py plugins/base/attack.py plugins/base/sensor.py plugins/base/ssh_features.py plugins/base/vulnerability_plugin.py app/attack_log.py app/calderacontrol.py \ No newline at end of file + mypy --strict-optional --disallow-untyped-defs --check-untyped-defs plugins/base/ app/ \ No newline at end of file diff --git a/mypy.ini b/mypy.ini new file mode 100644 index 0000000..94dcf19 --- /dev/null +++ b/mypy.ini @@ -0,0 +1,13 @@ +# My own Mypy configuration + +# Global settings +[mypy] +warn_unused_configs = True +mypy_path = $MYPY_CONFIG_FILE_DIR:$MYPY_CONFIG_FILE_DIR/app:$MYPY_CONFIG_FILE_DIR/plugins/base + + +# Setting for the main app +[mypy-app.*] + +# Setting for the plugins +[mypy-plugins.base.*] \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index b1aa4c4..74c66d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -22,7 +22,7 @@ sphinx-revealjs # sphinx-pydantic # This one has issues that must be fixed upstream first # Mypy stuff -mypy==0.910 +mypy==0.931 types-PyYAML==5.4.6 types-requests==2.25.6 types-simplejson==3.17.0 diff --git a/tox.ini b/tox.ini index fba54b8..b0429f1 100644 --- a/tox.ini +++ b/tox.ini @@ -36,6 +36,7 @@ deps = -r requirements.txt bandit pylint argcomplete + mypy commands = @@ -54,3 +55,5 @@ commands = # Linting # pylint *.py # currently off. Needs configuration python3 ./plugin_manager.py check + # mypy checks + mypy --strict-optional app/ plugins/base/ \ No newline at end of file