Only exit after `argparse` parsing is done

This commit is contained in:
Daniël van Noord 2022-04-02 16:28:22 +02:00
parent efca390ba0
commit aaeeb339be

View File

@ -76,12 +76,6 @@ def _config_initialization(
exc.code = 32
raise
# args_list should now only be a list of files/directories to lint. All options have
# been removed from the list
if not parsed_args_list:
print(linter.help())
sys.exit(32)
# We have loaded configuration from config file and command line. Now, we can
# load plugin specific configuration.
linter.load_plugin_configuration()
@ -103,4 +97,10 @@ def _config_initialization(
# Now that plugins are loaded, get list of all fail_on messages, and enable them
linter.enable_fail_on_messages()
# args_list should now only be a list of files/directories to lint. All options have
# been removed from the list
if not parsed_args_list:
print(linter.help())
sys.exit(32)
return parsed_args_list