From 3ac3349ef360e508d553765c19ae9f7b9abc51ed Mon Sep 17 00:00:00 2001 From: "Eric N. Vander Weele" Date: Fri, 1 Nov 2019 21:36:02 -0400 Subject: [PATCH] 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. --- src/flake8/main/application.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index 9555202..495cfa8 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -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