application: Simplify creation of configuration file finder

This commit simplifies and updates the method for handling the creation
of the configuration file finder.  The main takeaways are:

- Renaming the parameter (i.e., `extra_config_files`) to be a noun to
  better describe the input versus what the option name was called.
- Refreshed the docstring to align with changes from previous commits
  and this one.
- Remove the check to see if it a configuration file finder was already
  created.  This is not necessary as each entire run of a `flake8` calls
  this method once.  When the programmatic API is provided,
  configuration would be provided 'in-code' and not rely upon external
  files/resources.
- Use directly the program name from the `Application`, itself since
  this is the authoritative source for defining it.
This commit is contained in:
Eric N. Vander Weele 2019-11-01 21:36:02 -04:00
parent b5157e194d
commit 3ac3349ef3

View file

@ -133,17 +133,17 @@ class Application(object):
(self.result_count > 0) or self.catastrophic_failure
)
def make_config_finder(self, append_config):
def make_config_finder(self, extra_config_files):
# type: (List[str]) -> None
"""Make our ConfigFileFinder based on preliminary opts and args.
"""Make our ConfigFileFinder based on preliminary options.
:param list append_config:
List of configuration files to be parsed for configuration.
:param list extra_config_files:
List of addtional configuration files to be parsed for
configuration.
"""
if self.config_finder is None:
self.config_finder = config.ConfigFileFinder(
self.option_manager.program_name, append_config
)
self.config_finder = config.ConfigFileFinder(
self.program, extra_config_files
)
def find_plugins(self, config_file, ignore_config_files):
# type: (Optional[str], bool) -> None