Skip to content

Commit

Permalink
Specify glob pattern for Mypy to check
Browse files Browse the repository at this point in the history
Mypy's command-line file checking behavior is confusing. The docs at
https://mypy.readthedocs.io/en/latest/command_line.html say:

> Note that directories are checked recursively.

This doesn't appear to be entirely correct, for me at least. Running
`mypy .` recursively checks one, but not all, sub-directories.

```text
~/dev/template-python
.venv ❯ mypy . -v

LOG:  Mypy Version:           0.782
LOG:  Config File:            mypy.ini
LOG:  Source Paths:
      ./templatepython/__init__.py
      ./templatepython/examples/__init__.py
      ./templatepython/examples/fibonacci.py
      ./templatepython/examples/fizzbuzz.py
      ./templatepython/examples/palindrome.py
...

~/dev/template-python
.venv ❯ mypy **/*.py -v

LOG:  Mypy Version:           0.782
LOG:  Config File:            mypy.ini
LOG:  Source Paths:
      templatepython/__init__.py
      templatepython/examples/__init__.py
      templatepython/examples/fibonacci.py
      templatepython/examples/fizzbuzz.py
      templatepython/examples/palindrome.py
      tests/examples/test_fibonacci.py
      tests/examples/test_fizzbuzz.py
      tests/examples/test_palindrome.py
      tests/test_version.py
...

```

This commit will add the `**/*.py` glob pattern to mypy.ini to hopefully
reduce the confusion when running from the command line.
  • Loading branch information
br3ndonland committed Aug 17, 2020
1 parent d9703aa commit cbdbab4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mypy.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[mypy]
disallow_untyped_defs = True
strict_optional = True
files = **/*.py

0 comments on commit cbdbab4

Please sign in to comment.