summaryrefslogtreecommitdiff
path: root/src/flake8/main
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2019-12-29 17:22:26 -0500
committerEric N. Vander Weele <ericvw@gmail.com>2019-12-29 18:07:51 -0500
commit7f9f70064c50bbb6024fafed4568e0693f5640b5 (patch)
treea81485499d227115c26d3fadf3ed42302d67f413 /src/flake8/main
parentbb61b3df82a938f7cd1ca32daab4a31e4586b281 (diff)
downloadflake8-7f9f70064c50bbb6024fafed4568e0693f5640b5.tar.gz
aggregator: Forward --config and --isolated options during aggregation
This fixes a regression introduced in !346 to ensure that `--config` and `--isolated` are recognized in `aggregate_options()`. The regression manifested because `aggregate_options()` was relying on re-parsing `argv` to obtain the option values. However, !346 changed the preliminary parsing logic to only parse and "eat" what is necessary and forward along the options needed before all the configuration was loaded. This code path was overlooked because the tests in `test_aggregator()` were passing but the call from the `Application` object would never have these options in the remaining `argv` list to be passed long.
Diffstat (limited to 'src/flake8/main')
-rw-r--r--src/flake8/main/application.py29
1 files changed, 25 insertions, 4 deletions
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py
index 63db8e1..791d5af 100644
--- a/src/flake8/main/application.py
+++ b/src/flake8/main/application.py
@@ -169,17 +169,33 @@ class Application(object):
self.check_plugins.register_plugin_versions(self.option_manager)
self.formatting_plugins.register_options(self.option_manager)
- def parse_configuration_and_cli(self, config_finder, argv):
- # type: (config.ConfigFileFinder, List[str]) -> None
+ def parse_configuration_and_cli(
+ self,
+ config_finder, # type: config.ConfigFileFinder
+ config_file, # type: Optional[str]
+ ignore_config_files, # type: bool
+ argv, # type: List[str]
+ ):
+ # type: (...) -> None
"""Parse configuration files and the CLI options.
:param config.ConfigFileFinder config_finder:
The finder for finding and reading configuration files.
+ :param str config_file:
+ The optional configuraiton file to override all other configuration
+ files (i.e., the --config option).
+ :param bool ignore_config_files:
+ Determine whether to parse configuration files or not. (i.e., the
+ --isolated option).
:param list argv:
Command-line arguments passed in directly.
"""
self.options, self.args = aggregator.aggregate_options(
- self.option_manager, config_finder, argv
+ self.option_manager,
+ config_finder,
+ config_file,
+ ignore_config_files,
+ argv,
)
self.running_against_diff = self.options.diff
@@ -325,7 +341,12 @@ class Application(object):
config_finder, prelim_opts.config, prelim_opts.isolated
)
self.register_plugin_options()
- self.parse_configuration_and_cli(config_finder, remaining_args)
+ self.parse_configuration_and_cli(
+ config_finder,
+ prelim_opts.config,
+ prelim_opts.isolated,
+ remaining_args,
+ )
self.make_formatter()
self.make_guide()
self.make_file_checker_manager()