Skip to content

Commit

Permalink
mypy: Move remaining options on type-check semantics to config file.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gnprice committed May 7, 2018
1 parent cc9acbe commit 9f3052b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
6 changes: 6 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 0 additions & 14 deletions tools/run-mypy
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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")

Expand Down

0 comments on commit 9f3052b

Please sign in to comment.