MCPcopy Index your code
hub / github.com/FSoft-AI4Code/CodeWiki / validate_output_directory

Function validate_output_directory

codewiki/cli/utils/validation.py:101–129  ·  view source on GitHub ↗

Validate output directory path. Args: path: Directory path to validate Returns: Validated Path object Raises: ConfigurationError: If path is invalid

(path: str)

Source from the content-addressed store, hash-verified

99
100
101def validate_output_directory(path: str) -> Path:
102 """
103 Validate output directory path.
104
105 Args:
106 path: Directory path to validate
107
108 Returns:
109 Validated Path object
110
111 Raises:
112 ConfigurationError: If path is invalid
113 """
114 if not path or not path.strip():
115 raise ConfigurationError("Output directory cannot be empty")
116
117 try:
118 resolved_path = Path(path).expanduser().resolve()
119
120 # Check if path is writable (or parent is writable if path doesn't exist)
121 if resolved_path.exists():
122 if not resolved_path.is_dir():
123 raise ConfigurationError(
124 f"Output path exists but is not a directory: {path}"
125 )
126
127 return resolved_path
128 except Exception as e:
129 raise ConfigurationError(f"Invalid output directory path: {path}\nError: {e}")
130
131
132def validate_repository_path(path: Path) -> Path:

Callers

nothing calls this directly

Calls 2

ConfigurationErrorClass · 0.90
resolveMethod · 0.80

Tested by

no test coverage detected