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

Callers 1

generate_commandFunction · 0.90

Calls 3

validate_repository_pathFunction · 0.90
RepositoryErrorClass · 0.90

Tested by

no test coverage detected