tools/run-mypy: Cut redundant data from CLI parsing.

argparse has reasonable default behavior for the `dest` argument,
and for `default` at least in these two obvious cases.
So cut those out where we're just doing the default thing.

Also rewrap a couple of calls to fit at least in 100 columns.
This commit is contained in:
Greg Price
2017-09-26 14:10:20 -07:00
committed by Greg Price
parent 2949d1c1e8
commit be5b26dc68

View File

@@ -24,29 +24,31 @@ zproject/test_settings.py
""".split() """.split()
parser = argparse.ArgumentParser(description="Run mypy on files tracked by git.") parser = argparse.ArgumentParser(description="Run mypy on files tracked by git.")
parser.add_argument('targets', nargs='*', default=[], parser.add_argument('targets', nargs='*',
help="""files and directories to include in the result. help="""files and directories to include in the result.
If this is not specified, the current directory is used""") If this is not specified, the current directory is used""")
parser.add_argument('-m', '--modified', action='store_true', default=False, help='list only modified files') parser.add_argument('-m', '--modified', action='store_true',
parser.add_argument('-a', '--all', dest='all', action='store_true', default=False, help='list only modified files')
parser.add_argument('-a', '--all', action='store_true',
help="""run mypy on all python files, ignoring the exclude list. help="""run mypy on all python files, ignoring the exclude list.
This is useful if you have to find out which files fail mypy check.""") This is useful if you have to find out which files fail mypy check.""")
parser.add_argument('--linecoverage-report', dest='linecoverage_report', action='store_true', default=False, parser.add_argument('--linecoverage-report', action='store_true',
help="""run the linecoverage report to see annotation coverage""") help="""run the linecoverage report to see annotation coverage""")
parser.add_argument('--no-disallow-untyped-defs', dest='disallow_untyped_defs', action='store_false', default=True, parser.add_argument('--no-disallow-untyped-defs',
dest='disallow_untyped_defs', action='store_false',
help="""Don't throw errors when functions are not annotated""") help="""Don't throw errors when functions are not annotated""")
parser.add_argument('--scripts-only', dest='scripts_only', action='store_true', default=False, parser.add_argument('--scripts-only', action='store_true',
help="""Only type check extensionless python scripts""") help="""Only type check extensionless python scripts""")
parser.add_argument('--strict-optional', dest='strict_optional', action='store_true', default=False, parser.add_argument('--strict-optional', action='store_true',
help="""Use the --strict-optional flag with mypy""") help="""Use the --strict-optional flag with mypy""")
parser.add_argument('--warn-unused-ignores', dest='warn_unused_ignores', action='store_true', default=False, parser.add_argument('--warn-unused-ignores', action='store_true',
help="""Use the --warn-unused-ignores flag with mypy""") help="""Use the --warn-unused-ignores flag with mypy""")
parser.add_argument('--no-ignore-missing-imports', dest='ignore_missing_imports', action='store_false', default=True, parser.add_argument('--no-ignore-missing-imports',
dest='ignore_missing_imports', action='store_false',
help="""Don't use the --ignore-missing-imports flag with mypy""") help="""Don't use the --ignore-missing-imports flag with mypy""")
parser.add_argument('--quick', action='store_true', default=False, parser.add_argument('--quick', action='store_true',
help="""Use the --quick flag with mypy""") help="""Use the --quick flag with mypy""")
parser.add_argument('--force', default=False, parser.add_argument('--force', action="store_true",
action="store_true",
help='Run tests despite possible provisioning problems.') help='Run tests despite possible provisioning problems.')
args = parser.parse_args() args = parser.parse_args()