diff options
| author | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-26 09:32:39 -0500 |
|---|---|---|
| committer | Ian Cordasco <graffatcolmingov@gmail.com> | 2016-07-26 09:37:32 -0500 |
| commit | df2fa18a0865a202e91fcc0d8ca4a49b402baed3 (patch) | |
| tree | 36c7d02c27ff1e5a236c6de238a7c6447eb0cdc9 /src/flake8/options | |
| parent | f82b5d62d0c4e48b95466bb259f3401aecf28de7 (diff) | |
| download | flake8-df2fa18a0865a202e91fcc0d8ca4a49b402baed3.tar.gz | |
Fix project config file discovery
Flake8 3.0 was stopping once it found the current directory but the
historical behaviour (that we didn't intend to break) searched past
that (towards root) until it found one of the project/local config
file names that could be read.
Closes #181
Diffstat (limited to 'src/flake8/options')
| -rw-r--r-- | src/flake8/options/config.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py index ec5023b..d1408fe 100644 --- a/src/flake8/options/config.py +++ b/src/flake8/options/config.py @@ -43,8 +43,6 @@ class ConfigFileFinder(object): # List of filenames to find in the local/project directory self.project_filenames = ('setup.cfg', 'tox.ini', self.program_config) - self.local_directory = os.path.abspath(os.curdir) - if not args: args = ['.'] self.parent = self.tail = os.path.abspath(os.path.commonprefix(args)) @@ -72,14 +70,14 @@ class ConfigFileFinder(object): """Find and generate all local config files.""" tail = self.tail parent = self.parent - local_dir = self.local_directory - while tail: + found_config_files = False + while tail and not found_config_files: for project_filename in self.project_filenames: filename = os.path.abspath(os.path.join(parent, project_filename)) - yield filename - if parent == local_dir: - break + if os.path.exists(filename): + yield filename + found_config_files = True (parent, tail) = os.path.split(parent) def local_config_files(self): @@ -99,7 +97,6 @@ class ConfigFileFinder(object): return [ filename for filename in self.generate_possible_local_files() - if os.path.exists(filename) ] + [f for f in self.extra_config_files if exists(f)] def local_configs(self): |
