diff options
| author | Anthony Sottile <asottile@umich.edu> | 2019-10-23 17:58:38 +0000 |
|---|---|---|
| committer | Anthony Sottile <asottile@umich.edu> | 2019-10-23 17:58:38 +0000 |
| commit | e2c4b50a46e7913e55f79f328ccf1257f74b8a2a (patch) | |
| tree | 41e7e637bd944f3dc66130a866bb2bf1a038f63b /src | |
| parent | e0612597094234cd7acaad3d64b6c7071cdf1831 (diff) | |
| parent | 66f832d291faa6cf363546be19a625eda060475c (diff) | |
| download | flake8-e2c4b50a46e7913e55f79f328ccf1257f74b8a2a.tar.gz | |
Merge branch 'config-search-relative-to-cwd' into 'master'
Simplify configuration file search to be relative to cwd
See merge request pycqa/flake8!363
Diffstat (limited to 'src')
| -rw-r--r-- | src/flake8/api/legacy.py | 2 | ||||
| -rw-r--r-- | src/flake8/main/application.py | 10 | ||||
| -rw-r--r-- | src/flake8/options/config.py | 10 |
3 files changed, 8 insertions, 14 deletions
diff --git a/src/flake8/api/legacy.py b/src/flake8/api/legacy.py index a620930..1056fe9 100644 --- a/src/flake8/api/legacy.py +++ b/src/flake8/api/legacy.py @@ -32,7 +32,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.make_config_finder(prelim_opts.append_config) application.find_plugins(prelim_opts.config, prelim_opts.isolated) application.register_plugin_options() application.parse_configuration_and_cli([]) diff --git a/src/flake8/main/application.py b/src/flake8/main/application.py index 9b31b56..60b0c5c 100644 --- a/src/flake8/main/application.py +++ b/src/flake8/main/application.py @@ -152,18 +152,16 @@ class Application(object): (self.result_count > 0) or self.catastrophic_failure ) - def make_config_finder(self, append_config, args): - # type: (List[str], List[str]) -> None + def make_config_finder(self, append_config): + # type: (List[str]) -> None """Make our ConfigFileFinder based on preliminary opts and args. :param list append_config: List of configuration files to be parsed for configuration. - :param list args: - The list of file arguments passed from the CLI. """ if self.config_finder is None: self.config_finder = config.ConfigFileFinder( - self.option_manager.program_name, args, append_config + self.option_manager.program_name, append_config ) def find_plugins(self, config_file, ignore_config_files): @@ -363,7 +361,7 @@ class Application(object): argv ) flake8.configure_logging(prelim_opts.verbose, prelim_opts.output_file) - self.make_config_finder(prelim_opts.append_config, prelim_args) + self.make_config_finder(prelim_opts.append_config) self.find_plugins(prelim_opts.config, prelim_opts.isolated) self.register_plugin_options() self.parse_configuration_and_cli(argv) diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py index 9f3235d..9aebcba 100644 --- a/src/flake8/options/config.py +++ b/src/flake8/options/config.py @@ -16,14 +16,12 @@ __all__ = ("ConfigFileFinder", "MergedConfigParser") class ConfigFileFinder(object): """Encapsulate the logic for finding and reading config files.""" - def __init__(self, program_name, args, extra_config_files): - # type: (str, List[str], List[str]) -> None + def __init__(self, program_name, extra_config_files): + # type: (str, List[str]) -> None """Initialize object to find config files. :param str program_name: Name of the current program (e.g., flake8). - :param list args: - The extra arguments passed on the command-line. :param list extra_config_files: Extra configuration files specified by the user to read. """ @@ -46,9 +44,7 @@ class ConfigFileFinder(object): self.local_directory = os.path.abspath(os.curdir) - if not args: - args = ["."] - self.parent = self.tail = os.path.abspath(os.path.commonprefix(args)) + self.parent = self.tail = os.getcwd() # caches to avoid double-reading config files self._local_configs = None |
