Skip to content

Commit

Permalink
MyPy: Add the check-untyped-defs option for mypy. (#629)
Browse files Browse the repository at this point in the history
* Add the ability to specify `check-untyped-defs` in the
  options section for mypy.

Signed-off-by: G <px9e@gmx.fr>
Co-authored-by: G <px9e@gmx.fr>
  • Loading branch information
GuillaumeCrowdcomfort and PXke authored Oct 4, 2024
1 parent 8b82c53 commit 56e16cc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/profiles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,9 @@ The available options are:
| mypy | use-dmypy | Use mypy daemon (mypy server) for faster |
| | | checks |
+----------------+------------------------+----------------------------------------------+
| mypy | check-untyped-defs |Type check the interior of functions without |
| | |type annotations |
+----------------+------------------------+----------------------------------------------+
| bandit | config | configuration filename |
+----------------+------------------------+----------------------------------------------+
| bandit | profile | profile to use |
Expand Down
5 changes: 5 additions & 0 deletions prospector/tools/mypy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"python-2-mode",
"python-version",
"namespace-packages",
"check-untyped-defs",
]


Expand Down Expand Up @@ -90,6 +91,7 @@ def configure(self, prospector_config, _):
python_version = options.get("python-version", None)
strict_optional = options.get("strict-optional", False)
namespace_packages = options.get("namespace-packages", False)
check_untyped_defs = options.get("check-untyped-defs", False)

self.options.append(f"--follow-imports={follow_imports}")

Expand Down Expand Up @@ -117,6 +119,9 @@ def configure(self, prospector_config, _):
if namespace_packages:
self.options.append("--namespace-packages")

if check_untyped_defs:
self.options.append("--check-untyped-defs")

for list_option in LIST_OPTIONS:
for entry in options.get(list_option, []):
self.options.append(f"--{list_option}-{entry}")
Expand Down

0 comments on commit 56e16cc

Please sign in to comment.