Skip to content

Commit 79b33e7

Browse files
authored
feat(config): walk file hierarchy for project config (#1475)
The current naïve implementation of attempting to load configuration from the current working directory is insufficient for having project-wide selection of checks. Here, we traverse the file tree up from the current working directory in search of configuration files, enabling proselint to find them at the project root.
1 parent 92816e1 commit 79b33e7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

proselint/config/paths.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Configuration paths for proselint."""
22

33
import os
4+
from itertools import repeat
45
from pathlib import Path
56

67
XDG_CONFIG_VAR = "XDG_CONFIG_HOME"
@@ -21,5 +22,6 @@ def _get_xdg_path(env_var: str, default: Path) -> Path:
2122

2223
config_paths = [
2324
cwd / "proselint.json",
25+
*map(Path.__truediv__, cwd.parents, repeat("proselint.json")),
2426
config_user_path / "proselint" / "config.json",
2527
]

0 commit comments

Comments
 (0)