From 9f3052b0efb250a6935e9e4fad862b8d736c675d Mon Sep 17 00:00:00 2001 From: Greg Price Date: Sun, 6 May 2018 14:23:57 -0700 Subject: [PATCH] mypy: Move remaining options on type-check semantics to config file. This puts all of this config in one place, and also needs a lot fewer lines to describe it; which, combined, makes it a lot clearer what our normal config actually is. (I'd been looking at this script for a few minutes without realizing that we have `--disallow-untyped-defs` *on* by default, not off.) Experimenting with different values is still easy; just comment the line in the config. --- mypy.ini | 6 ++++++ tools/run-mypy | 14 -------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/mypy.ini b/mypy.ini index 7e87e41211..5fd3976d4a 100644 --- a/mypy.ini +++ b/mypy.ini @@ -6,14 +6,20 @@ cache_dir = var/mypy-cache # Options to make the checking stricter. check_untyped_defs = True +disallow_untyped_defs = True disallow_any_generics = True warn_no_return = True strict_optional = True no_implicit_optional = True +# 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. +#warn_unused_ignores = True + # Options to make the checking *less* strict, which we # might ideally eliminate. follow_imports = silent +ignore_missing_imports = True # REQ returning None issue diff --git a/tools/run-mypy b/tools/run-mypy index 710626a142..444e00d28a 100755 --- a/tools/run-mypy +++ b/tools/run-mypy @@ -38,14 +38,6 @@ parser.add_argument('--force', action="store_true", help="run tests despite possible provisioning problems") parser.add_argument('--linecoverage-report', action='store_true', help="emit a coverage report under var/") -parser.add_argument('--no-disallow-untyped-defs', - dest='disallow_untyped_defs', action='store_false', - help="don't pass --disallow-untyped-defs to mypy") -parser.add_argument('--warn-unused-ignores', action='store_true', - help="pass --warn-unused-ignores to mypy") -parser.add_argument('--no-ignore-missing-imports', - dest='ignore_missing_imports', action='store_false', - help="don't pass --ignore-missing-imports to mypy") args = parser.parse_args() if not args.force: @@ -87,12 +79,6 @@ extra_args = [] if args.linecoverage_report: extra_args.append("--linecoverage-report") extra_args.append("var/linecoverage-report") -if args.disallow_untyped_defs: - extra_args.append("--disallow-untyped-defs") -if args.warn_unused_ignores: - extra_args.append("--warn-unused-ignores") -if args.ignore_missing_imports: - extra_args.append("--ignore-missing-imports") if args.quick: extra_args.append("--quick")