application: Forward remaining unknown arguments to final CLI parsing

Now that `parse_preliminary_options_and_args()` ignores unknown options
and arguments, forward the remaining unknown arguments to the main CLI
and configuration method to be consumed.  This prevents re-parsing the
entire `argv` list again by forwarding the remaining arguments left to
be consumed.
This commit is contained in:
Eric N. Vander Weele 2019-10-25 15:20:06 -04:00
parent 4151ae0e53
commit 964b3a9c21
2 changed files with 4 additions and 4 deletions

View file

@ -28,14 +28,14 @@ def get_style_guide(**kwargs):
:class:`StyleGuide`
"""
application = app.Application()
prelim_opts, prelim_args = application.parse_preliminary_options_and_args(
prelim_opts, remaining_args = application.parse_preliminary_options_and_args( # noqa: E501
[]
)
flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file)
application.make_config_finder(prelim_opts.append_config)
application.find_plugins(prelim_opts.config, prelim_opts.isolated)
application.register_plugin_options()
application.parse_configuration_and_cli([])
application.parse_configuration_and_cli(remaining_args)
# We basically want application.initialize to be called but with these
# options set instead before we make our formatter, notifier, internal
# style guide and file checker manager.

View file

@ -338,14 +338,14 @@ class Application(object):
"""
# NOTE(sigmavirus24): When updating this, make sure you also update
# our legacy API calls to these same methods.
prelim_opts, prelim_args = self.parse_preliminary_options_and_args(
prelim_opts, remaining_args = self.parse_preliminary_options_and_args(
argv
)
flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file)
self.make_config_finder(prelim_opts.append_config)
self.find_plugins(prelim_opts.config, prelim_opts.isolated)
self.register_plugin_options()
self.parse_configuration_and_cli(argv)
self.parse_configuration_and_cli(remaining_args)
self.make_formatter()
self.make_guide()
self.make_file_checker_manager()