summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEric N. Vander Weele <ericvw@gmail.com>2020-01-12 15:33:54 -0800
committerEric N. Vander Weele <ericvw@gmail.com>2020-01-12 23:19:26 -0500
commit1e3bad20dd17981b66121d959b28faf6614edd7e (patch)
tree578cd3787ffc2495df5eb4c2e3d62b6c9bc72248 /src
parent77b2506071bec65d75e5259e00ceefb91ae50cf1 (diff)
downloadflake8-1e3bad20dd17981b66121d959b28faf6614edd7e.tar.gz
Remove unused 'cli_config' parameter
Now that `ConfigFileFinder.config_file` attribute is used everywhere and is constructed from the `--config` CLI option, the now unused `cli_config` parameters can be safely removed.
Diffstat (limited to 'src')
-rw-r--r--src/flake8/api/legacy.py5
-rw-r--r--src/flake8/main/application.py19
-rw-r--r--src/flake8/options/aggregator.py8
-rw-r--r--src/flake8/options/config.py10
4 files changed, 13 insertions, 29 deletions
diff --git a/src/flake8/api/legacy.py b/src/flake8/api/legacy.py
index 40da7db..68df9a2 100644
--- a/src/flake8/api/legacy.py
+++ b/src/flake8/api/legacy.py
@@ -34,13 +34,14 @@ def get_style_guide(**kwargs):
config_finder = config.ConfigFileFinder(
application.program,
prelim_opts.append_config,
+ config_file=prelim_opts.config,
ignore_config_files=prelim_opts.isolated,
)
- application.find_plugins(config_finder, prelim_opts.config)
+ application.find_plugins(config_finder)
application.register_plugin_options()
application.parse_configuration_and_cli(
- config_finder, prelim_opts.config, remaining_args,
+ config_finder, remaining_args,
)
# We basically want application.initialize to be called but with these
# options set instead before we make our formatter, notifier, internal
diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py
index b96a605..001ad6c 100644
--- a/src/flake8/main/application.py
+++ b/src/flake8/main/application.py
@@ -131,8 +131,8 @@ class Application(object):
(self.result_count > 0) or self.catastrophic_failure
)
- def find_plugins(self, config_finder, config_file):
- # type: (config.ConfigFileFinder, Optional[str]) -> None
+ def find_plugins(self, config_finder):
+ # type: (config.ConfigFileFinder) -> None
"""Find and load the plugins for this application.
Set the :attr:`check_plugins` and :attr:`formatting_plugins` attributes
@@ -140,11 +140,8 @@ class Application(object):
: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).
"""
- local_plugins = config.get_local_plugins(config_finder, config_file)
+ local_plugins = config.get_local_plugins(config_finder)
sys.path.extend(local_plugins.paths)
@@ -167,7 +164,6 @@ class Application(object):
def parse_configuration_and_cli(
self,
config_finder, # type: config.ConfigFileFinder
- config_file, # type: Optional[str]
argv, # type: List[str]
):
# type: (...) -> None
@@ -175,14 +171,11 @@ class Application(object):
: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 list argv:
Command-line arguments passed in directly.
"""
self.options, self.args = aggregator.aggregate_options(
- self.option_manager, config_finder, config_file, argv,
+ self.option_manager, config_finder, argv,
)
self.running_against_diff = self.options.diff
@@ -327,10 +320,10 @@ class Application(object):
config_file=prelim_opts.config,
ignore_config_files=prelim_opts.isolated,
)
- self.find_plugins(config_finder, prelim_opts.config)
+ self.find_plugins(config_finder)
self.register_plugin_options()
self.parse_configuration_and_cli(
- config_finder, prelim_opts.config, remaining_args,
+ config_finder, remaining_args,
)
self.make_formatter()
self.make_guide()
diff --git a/src/flake8/options/aggregator.py b/src/flake8/options/aggregator.py
index 939dfb3..bdcd6a3 100644
--- a/src/flake8/options/aggregator.py
+++ b/src/flake8/options/aggregator.py
@@ -5,7 +5,7 @@ applies the user-specified command-line configuration on top of it.
"""
import argparse
import logging
-from typing import List, Optional, Tuple
+from typing import List, Tuple
from flake8.options import config
from flake8.options.manager import OptionManager
@@ -16,7 +16,6 @@ LOG = logging.getLogger(__name__)
def aggregate_options(
manager, # type: OptionManager
config_finder, # type: config.ConfigFileFinder
- cli_config, # type: Optional[str]
argv, # type: List[str]
): # type: (...) -> Tuple[argparse.Namespace, List[str]]
"""Aggregate and merge CLI and config file options.
@@ -25,9 +24,6 @@ def aggregate_options(
The instance of the OptionManager that we're presently using.
:param flake8.options.config.ConfigFileFinder config_finder:
The config file finder to use.
- :param str cli_config:
- Value of --config when specified at the command-line. Overrides
- all other config files.
:param list argv:
The list of remaining command-line argumentsthat were unknown during
preliminary option parsing to pass to ``manager.parse_args``.
@@ -46,7 +42,7 @@ def aggregate_options(
)
# Get the parsed config
- parsed_config = config_parser.parse(cli_config)
+ parsed_config = config_parser.parse()
# Extend the default ignore value with the extended default ignore list,
# registered by plugins.
diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py
index a4a9783..af163ca 100644
--- a/src/flake8/options/config.py
+++ b/src/flake8/options/config.py
@@ -295,16 +295,13 @@ class MergedConfigParser(object):
return config
- def parse(self, cli_config=None):
+ def parse(self):
"""Parse and return the local and user config files.
First this copies over the parsed local configuration and then
iterates over the options in the user configuration and sets them if
they were not set by the local configuration file.
- :param str cli_config:
- Value of --config when specified at the command-line. Overrides
- all other config files.
:returns:
Dictionary of parsed configuration options
:rtype:
@@ -329,14 +326,11 @@ class MergedConfigParser(object):
return self.merge_user_and_local_config()
-def get_local_plugins(config_finder, cli_config=None):
+def get_local_plugins(config_finder):
"""Get local plugins lists from config files.
:param flake8.options.config.ConfigFileFinder config_finder:
The config file finder to use.
- :param str cli_config:
- Value of --config when specified at the command-line. Overrides
- all other config files.
:returns:
LocalPlugins namedtuple containing two lists of plugin strings,
one for extension (checker) plugins and one for report plugins.