diff options
| author | Jordan Wiens <github@psifertex.com> | 2026-01-21 15:25:58 -0500 |
|---|---|---|
| committer | Jordan Wiens <github@psifertex.com> | 2026-01-21 15:25:58 -0500 |
| commit | b29433a06db7138377620cbe98e7ebbf0cdc111c (patch) | |
| tree | fad968f4c8d677b91f76ad790b70bb97f0bd9a1d /scripts | |
| parent | 94f59640a77cfe1b8561a74df808fd3a368be632 (diff) | |
update checkdoc script to support globbing
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/check_docstring_formatting.py | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/scripts/check_docstring_formatting.py b/scripts/check_docstring_formatting.py index 9f91d082..c83271b3 100755 --- a/scripts/check_docstring_formatting.py +++ b/scripts/check_docstring_formatting.py @@ -279,13 +279,24 @@ def main(): if args.paths: files_to_check = [] for path_str in args.paths: - path = Path(path_str) - if path.is_dir(): - files_to_check.extend(find_python_files(path)) - elif path.is_file() and path.suffix == '.py': - files_to_check.append(path) + # Check if path contains glob characters + if any(c in path_str for c in '*?['): + matches = list(Path.cwd().glob(path_str)) + if not matches: + print(f"Warning: {path_str} did not match any files", file=sys.stderr) + for path in matches: + if path.is_dir(): + files_to_check.extend(find_python_files(path)) + elif path.is_file() and path.suffix == '.py': + files_to_check.append(path) else: - print(f"Warning: {path_str} is not a valid Python file or directory", file=sys.stderr) + path = Path(path_str) + if path.is_dir(): + files_to_check.extend(find_python_files(path)) + elif path.is_file() and path.suffix == '.py': + files_to_check.append(path) + else: + print(f"Warning: {path_str} is not a valid Python file or directory", file=sys.stderr) else: # Default to checking the python directory relative to this script script_dir = Path(__file__).parent |
