Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ tests/*
!tests/test_processing_order_update.py
!tests/test_leaf_selection.py
!tests/test_artifact_analyzer.py
!tests/test_scala_analyzer.py

# Jupyter
*.ipynb
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ CodeWiki is an open-source framework for **automated repository-level documentat

### Supported Languages

**🐍 Python** • **☕ Java** • **🟨 JavaScript** • **🔷 TypeScript** • **⚙️ C** • **🔧 C++** • **🪟 C#** • **🎯 Kotlin** • **🐘 PHP** • **💎 Ruby**
**🐍 Python** • **☕ Java** • **🟨 JavaScript** • **🔷 TypeScript** • **⚙️ C** • **🔧 C++** • **🪟 C#** • **🎯 Kotlin** • **🐘 PHP** • **💎 Ruby** • **🔺 Scala**

---

Expand Down
2 changes: 2 additions & 0 deletions codewiki/cli/utils/repo_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
".kt", # Kotlin
".kts", # Kotlin Scripts
".rb", # Ruby
".scala", # Scala
".sc", # Scala Scripts
}


Expand Down
1 change: 1 addition & 0 deletions codewiki/cli/utils/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ def detect_supported_languages(directory: Path) -> list[tuple[str, int]]:
"PHP": [".php", ".phtml", ".inc"],
"Kotlin": [".kt", ".kts"],
"Ruby": [".rb"],
"Scala": [".scala", ".sc"],
}

# Directories to exclude from counting
Expand Down
2 changes: 2 additions & 0 deletions codewiki/mcp/tools/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ def _detect_via_mtime(
".kt",
".kts",
".rb",
".scala",
".sc",
}

changed: list[str] = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def _filter_supported_languages(self, code_files: list[dict]) -> list[dict]:
"go",
"rust",
"kotlin",
"scala",
}

return [
Expand All @@ -375,6 +376,7 @@ def _get_supported_languages(self) -> list[str]:
"php",
"ruby",
"kotlin",
"scala",
]

def _cleanup_repository(self, temp_dir: str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ def _analyze_code_file(self, repo_dir: str, file_info: dict):
self._analyze_php_file(file_path, content, repo_dir)
elif language == "ruby":
self._analyze_ruby_file(file_path, content, repo_dir)
elif language == "scala":
self._analyze_scala_file(file_path, content, repo_dir)
# else:
# logger.warning(
# f"Unsupported language for call graph analysis: {language} for file {file_path}"
Expand Down Expand Up @@ -508,6 +510,28 @@ def _analyze_ruby_file(self, file_path: str, content: str, repo_dir: str):
except Exception:
logger.exception(f"Failed to analyze Ruby file {file_path}")

def _analyze_scala_file(self, file_path: str, content: str, repo_dir: str):
"""
Analyze Scala file using tree-sitter based analyzer.

Args:
file_path: Relative path to the Scala file
content: File content string
repo_dir: Repository base directory
"""
from codewiki.src.be.dependency_analyzer.analyzers.scala import analyze_scala_file

try:
functions, relationships = analyze_scala_file(file_path, content, repo_path=repo_dir)

for func in functions:
func_id = func.id if func.id else f"{file_path}:{func.name}"
self.functions[func_id] = func

self.call_relationships.extend(relationships)
except Exception:
logger.exception(f"Failed to analyze Scala file {file_path}")

def _resolve_call_relationships(self):
"""
Resolve function call relationships across all languages.
Expand Down Expand Up @@ -804,6 +828,8 @@ def _generate_visualization_data(self) -> dict:
node_classes.append("lang-php")
elif file_ext == ".rb":
node_classes.append("lang-ruby")
elif file_ext in [".scala", ".sc"]:
node_classes.append("lang-scala")

cytoscape_elements.append(
{
Expand Down
5 changes: 4 additions & 1 deletion codewiki/src/be/dependency_analyzer/analyzers/artifact.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ def is_artifact_file_node(node: Any) -> bool:
"build.gradle.kts",
"settings.gradle",
"settings.gradle.kts",
"build.sbt",
"Package.swift",
"pubspec.yaml",
"Pipfile",
Expand Down Expand Up @@ -293,7 +294,7 @@ def is_artifact_file_node(node: Any) -> bool:
"Gruntfile.js",
"Herebyfile.mjs",
}
_BUILD_EXTS = {".gn", ".gni", ".gradle", ".rake", ".mk", ".cmake", ".bzl", ".ninja"}
_BUILD_EXTS = {".gn", ".gni", ".gradle", ".rake", ".mk", ".cmake", ".bzl", ".ninja", ".sbt"}
_BUILD_CONFIG_RE = re.compile(r"^(webpack|rollup|vite|esbuild|tsup|babel)\.config\.[cm]?[jt]s$")
_BUILD_TOPS = {"build", "rakelib", "cmake"}
_TEST_INFRA_NAMES = {
Expand Down Expand Up @@ -427,6 +428,8 @@ def classify_artifact(
".cs",
".php",
".kt",
".scala",
".sc",
}:
if name in _TEST_INFRA_NAMES:
return "test_infra"
Expand Down
Loading
Loading