mypy and flake8-mypy are giving different results
I've used strace and from what I can see, flake8 is mostly ignoring any defaults or explicit options saying where to find the mypy configuration.
Specifically the file not being treated properly is also a tests/test_foo.py not sure if that makes any difference.
See log from gitter below:
David Novakovic @dpnova 20:40
hey all.. I've got an issue with running mypy vs flake8-mymy and getting different results
it's with a file that's "test_foo.py" - i could flake8 could be ignoring something there
Ivan Levkivskyi @ilevkivskyi 20:41
This may be because mypy-flake8 uses some mypy flags on by default
David Novakovic @dpnova 20:41
I have an explicit mypy.ini
so if either one of them is not respecting it that would certainly be an issue
Ivan Levkivskyi @ilevkivskyi 20:41
are you sure mypy-flake8 is using it?
David Novakovic @dpnova 20:42
no.. I'll run with strace to check
tbh I ran flake8 in verbose mode and it didnt seem to mention mypy at all..
Ivan Levkivskyi @ilevkivskyi 20:43
also are you using flake8-mypy or mypy-flake8?
David Novakovic @dpnova 20:43
flake8-mypy
i didnt know there was another one haha
flake8==3.4.1
flake8-mypy==17.3.3
Ivan Levkivskyi @ilevkivskyi 20:44
@ambv this maybe then a question for you
David Novakovic @dpnova 20:44
from pip freeze
hmm let me check something
Ivan Levkivskyi @ilevkivskyi 20:45
are you using --mypy-config= flag for flake8-mypy?
because you should
see https://github.com/ambv/flake8-mypy#configuration
David Novakovic @dpnova 20:48
doing that made no difference
and this is working in other files..
just not this test file..
INSERT dpn (e) nibble ~ workspace nibble mypy nibble 1 master
nibble/bills/tests/test_models.py:8:12: error: Too few arguments for "Bill"
INSERT dpn (e) nibble ~ workspace nibble flake8 nibble 1 master
INSERT dpn (e) nibble ~ workspace nibble flake8 nibble --mypy-config=mypy.ini master
INSERT dpn (e) nibble ~ workspace nibble cat mypy.ini master
[mypy]
# Specify the target platform details in config, so your developers are
# free to run mypy on Windows, Linux, or macOS and get consistent
# results.
python_version=3.6
platform=linux
# flake8-mypy expects the two following for sensible formatting
show_column_numbers=True
show_error_context=False
# do not follow imports (except for ones found in typeshed)
follow_imports=skip
# suppress errors about unsatisfied imports
ignore_missing_imports=True
# allow untyped calls as a consequence of the options above
disallow_untyped_calls=False
# allow returning Any as a consequence of the options above
warn_return_any=False
# treat Optional per PEP 484
strict_optional=True
# ensure all execution paths are returning
warn_no_return=True
# lint-style cleanliness for typing
warn_redundant_casts=True
warn_unused_ignores=True
# The following are off by default. Flip them on if you feel
# adventurous.
disallow_untyped_defs=True
check_untyped_defs=True
David Novakovic @dpnova 20:56
can confirm that passing the config location to flake8 actually doesn't load the config
Ivan Levkivskyi @ilevkivskyi 21:00
You can also try ... with the .flake8/setup.cfg equivalent being called mypy_config
besides this suggestion my expertise ends, you could wait for @ambv or just file an issue on the tracker https://github.com/ambv/flake8-mypy/issues
David Novakovic @dpnova 21:05
thanks @ilevkivskyi i actually did just try that to no avail.. thanks for the help!
Just noticed when i explicitly give flake8 an empty config I see the missing errors.
I cannot reproduce your issue. Are you saying that passing a custom mypy.ini in .flake8, setup.cfg, or on the flake8 command-line doesn't work? It certainly does for me.
I'll put together a minimal case to repro tonight. Thanks for checking this out.