summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2019-10-01 08:48:18 +0200
committerEric N. Vander Weele <ericvw@gmail.com>2019-10-01 08:48:18 +0200
commit95a88e3fcd84f45eb6c0869cb095ea9089dfed44 (patch)
tree5f5167c8c915def5bf468fdc52e93dfe1e3b32e1 /src
parent32ebb4fa55ae49f28ab7aa175b6519db21d42dbb (diff)
downloadflake8-95a88e3fcd84f45eb6c0869cb095ea9089dfed44.tar.gz
application: Pass prelim opts to `.find_plugins()`
The configuration file and boolean to ignore configuration files can be threaded through now that `.parse_preliminary_options_and_args()` returns options and arguments.
Diffstat (limited to 'src')
-rw-r--r--src/flake8/api/legacy.py2
-rw-r--r--src/flake8/main/application.py17
2 files changed, 12 insertions, 7 deletions
diff --git a/src/flake8/api/legacy.py b/src/flake8/api/legacy.py
index b680346..a620930 100644
--- a/src/flake8/api/legacy.py
+++ b/src/flake8/api/legacy.py
@@ -33,7 +33,7 @@ def get_style_guide(**kwargs):
)
flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file)
application.make_config_finder(prelim_opts.append_config, prelim_args)
- application.find_plugins()
+ application.find_plugins(prelim_opts.config, prelim_opts.isolated)
application.register_plugin_options()
application.parse_configuration_and_cli([])
# We basically want application.initialize to be called but with these
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py
index 0eb1abd..0580766 100644
--- a/src/flake8/main/application.py
+++ b/src/flake8/main/application.py
@@ -174,8 +174,8 @@ class Application(object):
self.option_manager.program_name, args, append_config
)
- def find_plugins(self):
- # type: () -> None
+ def find_plugins(self, config_file, ignore_config_files):
+ # type: (Optional[str], bool) -> None
"""Find and load the plugins for this application.
If :attr:`check_plugins`, or :attr:`formatting_plugins` are ``None``
@@ -183,12 +183,17 @@ class Application(object):
instance. Given the expense of finding plugins (via :mod:`entrypoints`)
we want this to be idempotent and so only update those attributes if
they are ``None``.
+
+ :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).
"""
if self.local_plugins is None:
self.local_plugins = config.get_local_plugins(
- self.config_finder,
- self.prelim_opts.config,
- self.prelim_opts.isolated,
+ self.config_finder, config_file, ignore_config_files
)
sys.path.extend(self.local_plugins.paths)
@@ -367,7 +372,7 @@ class Application(object):
)
flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file)
self.make_config_finder(prelim_opts.append_config, prelim_args)
- self.find_plugins()
+ self.find_plugins(prelim_opts.config, prelim_opts.isolated)
self.register_plugin_options()
self.parse_configuration_and_cli(argv)
self.make_formatter()