mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-15 16:49:52 +00:00
Fix config file search.
Before this fix, it would recurse upwards, stopping if new_path was equal to home_path *before* actually checking home_path. Now it recurses up to *and including* home_path.
This commit is contained in:
parent
2b3d18f0e9
commit
299aa3e9ed
1 changed files with 5 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
"""Config handling logic for Flake8."""
|
"""Config handling logic for Flake8."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import configparser
|
import configparser
|
||||||
|
|
@ -41,9 +42,12 @@ def _find_config_file(path: str) -> str | None:
|
||||||
if "flake8" in cfg or "flake8:local-plugins" in cfg:
|
if "flake8" in cfg or "flake8:local-plugins" in cfg:
|
||||||
return cfg_path
|
return cfg_path
|
||||||
|
|
||||||
|
if dir_stat == home_stat:
|
||||||
|
break
|
||||||
|
|
||||||
new_path = os.path.dirname(path)
|
new_path = os.path.dirname(path)
|
||||||
new_dir_stat = _stat_key(new_path)
|
new_dir_stat = _stat_key(new_path)
|
||||||
if new_dir_stat == dir_stat or new_dir_stat == home_stat:
|
if new_dir_stat == dir_stat:
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
path = new_path
|
path = new_path
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue