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:
Yonatan Zunger 2025-08-27 18:34:56 -07:00
parent 2b3d18f0e9
commit 299aa3e9ed

View file

@ -1,4 +1,5 @@
"""Config handling logic for Flake8."""
from __future__ import annotations
import configparser
@ -41,9 +42,12 @@ def _find_config_file(path: str) -> str | None:
if "flake8" in cfg or "flake8:local-plugins" in cfg:
return cfg_path
if dir_stat == home_stat:
break
new_path = os.path.dirname(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
else:
path = new_path