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

Function detect_supported_languages

codewiki/cli/utils/validation.py:156–207  ·  view source on GitHub ↗

Detect supported programming languages in a directory. Args: directory: Directory to scan Returns: List of (language, file_count) tuples

(directory: Path)

Source from the content-addressed store, hash-verified

154
155 Returns:
156 List of (language, file_count) tuples
157 """
158 language_extensions = {
159 "Python": [".py"],
160 "Java": [".java"],
161 "JavaScript": [".js", ".jsx"],
162 "TypeScript": [".ts", ".tsx"],
163 "C": [".c", ".h"],
164 "C++": [".cpp", ".hpp", ".cc", ".hh", ".cxx", ".hxx"],
165 "C#": [".cs"],
166 "PHP": [".php", ".phtml", ".inc"],
167 "Kotlin": [".kt", ".kts"],
168 "Ruby": [".rb"],
169 "Scala": [".scala", ".sc"],
170 "Rust": [".rs"],
171 "Dart": [".dart"],
172 "Go": [".go"],
173 "Zig": [".zig"],
174 "Lean": [".lean"],
175 "Vue": [".vue"],
176 }
177
178 # Directories to exclude from counting
179 excluded_dirs = {
180 "node_modules",
181 "__pycache__",
182 ".git",
183 "build",
184 "dist",
185 ".venv",
186 "venv",
187 "env",
188 ".env",
189 "target",
190 "bin",
191 "obj",
192 ".pytest_cache",
193 ".mypy_cache",
194 ".tox",
195 "coverage",
196 "htmlcov",
197 ".eggs",
198 "*.egg-info",
199 "vendor",
200 "bower_components",
201 ".idea",
202 ".vscode",
203 ".gradle",
204 ".mvn",
205 }
206
207 def should_exclude_file(file_path: Path) -> bool:
208 """Check if file is in an excluded directory."""
209 try:
210 parts = file_path.relative_to(directory).parts

Callers 1

validate_repositoryFunction · 0.90

Calls 1

should_exclude_fileFunction · 0.85

Tested by

no test coverage detected