mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-04 12:16:53 +00:00
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:
parent
4151ae0e53
commit
964b3a9c21
2 changed files with 4 additions and 4 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue