Skip to content

Commit c8a2bf1

Browse files
committed
cli: match excluded dirs relative to the scanned directory
detect_supported_languages checked excluded dir names against the absolute path, so a repo living under e.g. ~/build/ or a .venv-named parent had every file excluded. Match against the path relative to the scanned directory.
1 parent 8a19a91 commit c8a2bf1

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎codewiki/cli/utils/validation.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,10 @@ def detect_supported_languages(directory: Path) -> list[tuple[str, int]]:
201201

202202
def should_exclude_file(file_path: Path) -> bool:
203203
"""Check if file is in an excluded directory."""
204-
parts = file_path.parts
204+
try:
205+
parts = file_path.relative_to(directory).parts
206+
except ValueError:
207+
parts = file_path.parts
205208
return any(excluded_dir in parts for excluded_dir in excluded_dirs)
206209

207210
language_counts = {}

0 commit comments

Comments
 (0)