@@ -70,6 +70,10 @@ def main(script_path: Optional[str], args: Optional[List[str]] = None) -> None:
7070 fscache = FileSystemCache ()
7171 sources , options = process_options (args , fscache = fscache )
7272
73+ if sources is None :
74+ # indicates early out
75+ sys .exit (0 )
76+
7377 messages = []
7478
7579 def flush_errors (new_messages : List [str ], serious : bool ) -> None :
@@ -299,7 +303,7 @@ def process_options(args: List[str],
299303 fscache : Optional [FileSystemCache ] = None ,
300304 program : str = 'mypy' ,
301305 header : str = HEADER ,
302- ) -> Tuple [List [BuildSource ], Options ]:
306+ ) -> Tuple [Optional [ List [BuildSource ] ], Options ]:
303307 """Parse command line arguments.
304308
305309 If a FileSystemCache is passed in, and package_root options are given,
@@ -704,19 +708,19 @@ def add_invertible_flag(flag: str,
704708 # filename for the config file and know if the user requested all strict options.
705709 dummy = argparse .Namespace ()
706710 parser .parse_args (args , dummy )
711+ options = Options ()
707712
708713 if dummy .list_error_codes :
709714 import mypy .messages
710715 for msg_id in sorted (mypy .messages .MessageBuilder .get_message_ids ()):
711716 print (msg_id )
712- raise SystemExit ( 0 )
717+ return None , options
713718
714719 config_file = dummy .config_file
715720 if config_file is not None and not os .path .exists (config_file ):
716721 parser .error ("Cannot find config file '%s'" % config_file )
717722
718723 # Parse config file first, so command line can override.
719- options = Options ()
720724 parse_config_file (options , config_file )
721725
722726 # Set strict flags before parsing (if strict mode enabled), so other command
0 commit comments