Repository: GaloisInc/cclyzerpp (language: cpp)

Issue:
ci: Lint with Mypy
Mypy should be run on the Python-based test suite in CI.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3d864f1..0249d57 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -106,7 +106,7 @@ jobs:
       - name: Install linting tools
         run: |
           sudo apt-get update
-          sudo apt-get install -y clang-format
+          sudo apt-get install -y clang-format mypy
 
       - name: Run linting script
         run: bash scripts/lint.sh
diff --git a/docker/dev.dockerfile b/docker/dev.dockerfile
index c202180..78d6783 100644
--- a/docker/dev.dockerfile
+++ b/docker/dev.dockerfile
@@ -44,6 +44,7 @@ RUN apt-get update && \
     update-alternatives --install /usr/bin/opt opt /usr/bin/opt-${LLVM_VERSION} 60 && \
     rm -rf /var/lib/apt/lists/*
 RUN pip install \
+      mypy==0.982 \
       pytest==7.1.3 \
       pytest-xdist==2.5.0
-# TODO(lb): Sphinx, Mypy
+# TODO(lb): Sphinx
diff --git a/scripts/lint.sh b/scripts/lint.sh
index 7cb9752..31662b4 100644
--- a/scripts/lint.sh
+++ b/scripts/lint.sh
@@ -5,3 +5,6 @@ set -eo pipefail
 for f in ./*.cpp ./FactGenerator/**/*.cpp; do
   clang-format-10 "${f}" | diff "${f}" -
 done
+
+cd test
+mypy .


Test patch:
diff --git a/test/mypy.ini b/test/mypy.ini
index 33c69a0..870bc30 100644
--- a/test/mypy.ini
+++ b/test/mypy.ini
@@ -1,7 +1,12 @@
 [mypy]
-check_untyped_defs = True
+disallow_any_generics = True
+disallow_incomplete_defs = True
+# TODO(lb): Enable this
+disallow_untyped_defs = False
 ignore_missing_imports = True
+implicit_reexport = False
 no_implicit_optional = True
+show_error_codes = True
 warn_redundant_casts = True
 warn_unused_configs = True
 warn_unused_ignores = True
\ No newline at end of file
diff --git a/test/pa_invariant_test.py b/test/pa_invariant_test.py
index 0979597..5dd9e3c 100644
--- a/test/pa_invariant_test.py
+++ b/test/pa_invariant_test.py
@@ -81,7 +81,7 @@ class BinaryRelationProperty(Enum):
 T = TypeVar("T")
 
 
-def binary(row0, row1) -> Tuple[Row, Row]:
+def binary(row0: SouffleType, row1: SouffleType) -> Tuple[Row, Row]:
     return ((row0,), (row1,))