From 6d5158433e52b764154bee71e8cfd3ba9f89c0ec Mon Sep 17 00:00:00 2001 From: mdevolde Date: Sat, 20 Jun 2026 19:02:51 +0200 Subject: [PATCH] fix(config_file): allow directories in _path_validator --- language_tool_python/config_file.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/language_tool_python/config_file.py b/language_tool_python/config_file.py index 4e3987e..9b47401 100644 --- a/language_tool_python/config_file.py +++ b/language_tool_python/config_file.py @@ -141,19 +141,19 @@ def _path_encoder(v: PathLike[str] | str) -> str: def _path_validator(v: PathLike[str] | str) -> None: - """Validate that a given path exists and is a file. + """Validate that a given path exists and is a file or directory. :param v: The path to validate, which will be converted to a Path object :type v: PathLike[str] | str :raises PathError: If the path does not exist - :raises PathError: If the path exists but is not a file + :raises PathError: If the path exists but is not a file or directory """ p = Path(v) if not p.exists(): err = f"path does not exist: {p}" raise PathError(err) - if not p.is_file(): - err = f"path is not a file: {p}" + if not p.is_file() and not p.is_dir(): + err = f"path is not a file/directory: {p}" raise PathError(err)