MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / validate_repository

Function validate_repository

codewiki/cli/utils/repo_validator.py:38–71  ·  view source on GitHub ↗

Validate repository for documentation generation. Checks: - Path exists and is a directory - Contains supported code files - Has sufficient files for meaningful documentation Args: repo_path: Path to repository Returns: Tuple of (valida

(repo_path: Path)

Source from the content-addressed store, hash-verified

36
37
38def validate_repository(repo_path: Path) -> Tuple[Path, List[Tuple[str, int]]]:
39 """
40 Validate repository for documentation generation.
41
42 Checks:
43 - Path exists and is a directory
44 - Contains supported code files
45 - Has sufficient files for meaningful documentation
46
47 Args:
48 repo_path: Path to repository
49
50 Returns:
51 Tuple of (validated_path, language_counts)
52
53 Raises:
54 RepositoryError: If validation fails
55 """
56 # Validate path exists
57 repo_path = validate_repository_path(repo_path)
58
59 # Detect languages
60 languages = detect_supported_languages(repo_path)
61
62 if not languages:
63 raise RepositoryError(
64 f"No supported code files found in {repo_path}\n\n"
65 "CodeWiki supports: Python, Java, JavaScript, TypeScript, C, C++, C#, PHP\n\n"
66 "Please navigate to a code repository or specify a custom directory:\n"
67 " cd /path/to/your/project\n"
68 " codewiki generate"
69 )
70
71 return repo_path, languages
72
73
74def check_writable_output(output_dir: Path) -> Path:

Callers 1

generate_commandFunction · 0.90

Calls 3

validate_repository_pathFunction · 0.90
RepositoryErrorClass · 0.90

Tested by

no test coverage detected