@@ -70,6 +70,10 @@ def main(script_path: Optional[str], args: Optional[List[str]] = None) -> None:
70
70
fscache = FileSystemCache ()
71
71
sources , options = process_options (args , fscache = fscache )
72
72
73
+ if sources is None :
74
+ # indicates early out
75
+ sys .exit (0 )
76
+
73
77
messages = []
74
78
75
79
def flush_errors (new_messages : List [str ], serious : bool ) -> None :
@@ -299,7 +303,7 @@ def process_options(args: List[str],
299
303
fscache : Optional [FileSystemCache ] = None ,
300
304
program : str = 'mypy' ,
301
305
header : str = HEADER ,
302
- ) -> Tuple [List [BuildSource ], Options ]:
306
+ ) -> Tuple [Optional [ List [BuildSource ] ], Options ]:
303
307
"""Parse command line arguments.
304
308
305
309
If a FileSystemCache is passed in, and package_root options are given,
@@ -704,19 +708,19 @@ def add_invertible_flag(flag: str,
704
708
# filename for the config file and know if the user requested all strict options.
705
709
dummy = argparse .Namespace ()
706
710
parser .parse_args (args , dummy )
711
+ options = Options ()
707
712
708
713
if dummy .list_error_codes :
709
714
import mypy .messages
710
715
for msg_id in sorted (mypy .messages .MessageBuilder .get_message_ids ()):
711
716
print (msg_id )
712
- raise SystemExit ( 0 )
717
+ return None , options
713
718
714
719
config_file = dummy .config_file
715
720
if config_file is not None and not os .path .exists (config_file ):
716
721
parser .error ("Cannot find config file '%s'" % config_file )
717
722
718
723
# Parse config file first, so command line can override.
719
- options = Options ()
720
724
parse_config_file (options , config_file )
721
725
722
726
# Set strict flags before parsing (if strict mode enabled), so other command
0 commit comments