@@ -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 :
@@ -297,7 +301,7 @@ def process_options(args: List[str],
297
301
require_targets : bool = True ,
298
302
server_options : bool = False ,
299
303
fscache : Optional [FileSystemCache ] = None ,
300
- ) -> Tuple [List [BuildSource ], Options ]:
304
+ ) -> Tuple [Optional [ List [BuildSource ] ], Options ]:
301
305
"""Parse command line arguments.
302
306
303
307
If a FileSystemCache is passed in, and package_root options are given,
@@ -702,19 +706,19 @@ def add_invertible_flag(flag: str,
702
706
# filename for the config file and know if the user requested all strict options.
703
707
dummy = argparse .Namespace ()
704
708
parser .parse_args (args , dummy )
709
+ options = Options ()
705
710
706
711
if dummy .list_error_codes :
707
712
import mypy .messages
708
713
for msg_id in sorted (mypy .messages .MessageBuilder .get_message_ids ()):
709
714
print (msg_id )
710
- raise SystemExit ( 0 )
715
+ return None , options
711
716
712
717
config_file = dummy .config_file
713
718
if config_file is not None and not os .path .exists (config_file ):
714
719
parser .error ("Cannot find config file '%s'" % config_file )
715
720
716
721
# Parse config file first, so command line can override.
717
- options = Options ()
718
722
parse_config_file (options , config_file )
719
723
720
724
# Set strict flags before parsing (if strict mode enabled), so other command
0 commit comments