mirror of https://github.com/zulip/zulip.git
mypy: In non-daemon mode, follow package imports.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
This commit is contained in:
parent
86f8bb83ab
commit
fc6a8396ed
52
mypy.ini
52
mypy.ini
|
@ -14,19 +14,10 @@ disallow_any_generics = True
|
||||||
warn_no_return = True
|
warn_no_return = True
|
||||||
no_implicit_optional = True
|
no_implicit_optional = True
|
||||||
|
|
||||||
# The mypy daemon requires using local_partial_types.
|
|
||||||
local_partial_types = True
|
|
||||||
|
|
||||||
# It's useful to try this occasionally, and keep it clean; but when
|
# It's useful to try this occasionally, and keep it clean; but when
|
||||||
# someone fixes a type error we don't want to add a burden for them.
|
# someone fixes a type error we don't want to add a burden for them.
|
||||||
#warn_unused_ignores = True
|
#warn_unused_ignores = True
|
||||||
|
|
||||||
# Error on importing modules that are present but not part of the
|
|
||||||
# build. If the module can't reasonably be made to not error, errors
|
|
||||||
# can be suppressed with ignore_errors.
|
|
||||||
# (The mypy daemon only supports error and skip for follow_imports)
|
|
||||||
follow_imports = error
|
|
||||||
|
|
||||||
# We use a lot of third-party libraries we don't have stubs for, as
|
# We use a lot of third-party libraries we don't have stubs for, as
|
||||||
# well as a handful of our own modules that we haven't told mypy how
|
# well as a handful of our own modules that we haven't told mypy how
|
||||||
# to find. Ignore them. (For some details, see:
|
# to find. Ignore them. (For some details, see:
|
||||||
|
@ -60,49 +51,6 @@ ignore_errors = True
|
||||||
ignore_errors = True
|
ignore_errors = True
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# SKIP IMPORTS
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
[mypy-zulip]
|
|
||||||
# mypy is finding this module in the virtualenv. We should tell it
|
|
||||||
# about it on the command line; until we do, everything imported from
|
|
||||||
# it gets treated as Any, and we have to acknowledge it here.
|
|
||||||
#
|
|
||||||
# (The mypy daemon insists that everything it checks, it's told about
|
|
||||||
# in advance, which means setting follow_imports to either `skip` or
|
|
||||||
# `error`. Our global setting of `error` gets us an error if there's
|
|
||||||
# something it *could* check, because it can find the file, but we
|
|
||||||
# haven't told it to.)
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
[mypy-zulint]
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
[mypy-zulint.command]
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
[mypy-zulint.custom_rules]
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
[mypy-zulint.linters]
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
[mypy-zulint.lister]
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
[mypy-zulint.printer]
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
[mypy-zulip_bots.custom_exceptions]
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
[mypy-zulip_bots.lib]
|
|
||||||
follow_imports = skip
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# STRICT OPTIONAL
|
# STRICT OPTIONAL
|
||||||
|
|
|
@ -18,7 +18,8 @@ set -x
|
||||||
# backend tests, which tend to uncover more serious problems, first.
|
# backend tests, which tend to uncover more serious problems, first.
|
||||||
./tools/run-mypy --version
|
./tools/run-mypy --version
|
||||||
# We run mypy without daemon mode, since that's faster given that
|
# We run mypy without daemon mode, since that's faster given that
|
||||||
# we're only going to run it once.
|
# we're only going to run it once, and catches more errors since
|
||||||
|
# daemon mode doesn't follow package imports.
|
||||||
./tools/run-mypy --no-daemon
|
./tools/run-mypy --no-daemon
|
||||||
|
|
||||||
./tools/test-migrations
|
./tools/test-migrations
|
||||||
|
|
|
@ -78,6 +78,7 @@ mypy_args = extra_args + python_files + pyi_files
|
||||||
if args.no_daemon:
|
if args.no_daemon:
|
||||||
rc = subprocess.call([mypy_command] + mypy_args)
|
rc = subprocess.call([mypy_command] + mypy_args)
|
||||||
else:
|
else:
|
||||||
|
mypy_args += ["--follow-imports=skip"]
|
||||||
rc = subprocess.call([mypy_command, "status"], stdout=subprocess.PIPE)
|
rc = subprocess.call([mypy_command, "status"], stdout=subprocess.PIPE)
|
||||||
if rc != 0:
|
if rc != 0:
|
||||||
print("Starting mypy daemon, this will take a minute...")
|
print("Starting mypy daemon, this will take a minute...")
|
||||||
|
|
Loading…
Reference in New Issue