@@ -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 :
@@ -297,7 +301,7 @@ def process_options(args: List[str],
297301 require_targets : bool = True ,
298302 server_options : bool = False ,
299303 fscache : Optional [FileSystemCache ] = None ,
300- ) -> Tuple [List [BuildSource ], Options ]:
304+ ) -> Tuple [Optional [ List [BuildSource ] ], Options ]:
301305 """Parse command line arguments.
302306
303307 If a FileSystemCache is passed in, and package_root options are given,
@@ -702,19 +706,19 @@ def add_invertible_flag(flag: str,
702706 # filename for the config file and know if the user requested all strict options.
703707 dummy = argparse .Namespace ()
704708 parser .parse_args (args , dummy )
709+ options = Options ()
705710
706711 if dummy .list_error_codes :
707712 import mypy .messages
708713 for msg_id in sorted (mypy .messages .MessageBuilder .get_message_ids ()):
709714 print (msg_id )
710- raise SystemExit ( 0 )
715+ return None , options
711716
712717 config_file = dummy .config_file
713718 if config_file is not None and not os .path .exists (config_file ):
714719 parser .error ("Cannot find config file '%s'" % config_file )
715720
716721 # Parse config file first, so command line can override.
717- options = Options ()
718722 parse_config_file (options , config_file )
719723
720724 # Set strict flags before parsing (if strict mode enabled), so other command
0 commit comments