@@ -253,6 +253,8 @@ def _analyze_code_file(self, repo_dir: str, file_info: dict):
253253 self ._analyze_php_file (file_path , content , repo_dir )
254254 elif language == "ruby" :
255255 self ._analyze_ruby_file (file_path , content , repo_dir )
256+ elif language == "scala" :
257+ self ._analyze_scala_file (file_path , content , repo_dir )
256258 # else:
257259 # logger.warning(
258260 # f"Unsupported language for call graph analysis: {language} for file {file_path}"
@@ -508,6 +510,28 @@ def _analyze_ruby_file(self, file_path: str, content: str, repo_dir: str):
508510 except Exception :
509511 logger .exception (f"Failed to analyze Ruby file { file_path } " )
510512
513+ def _analyze_scala_file (self , file_path : str , content : str , repo_dir : str ):
514+ """
515+ Analyze Scala file using tree-sitter based analyzer.
516+
517+ Args:
518+ file_path: Relative path to the Scala file
519+ content: File content string
520+ repo_dir: Repository base directory
521+ """
522+ from codewiki .src .be .dependency_analyzer .analyzers .scala import analyze_scala_file
523+
524+ try :
525+ functions , relationships = analyze_scala_file (file_path , content , repo_path = repo_dir )
526+
527+ for func in functions :
528+ func_id = func .id if func .id else f"{ file_path } :{ func .name } "
529+ self .functions [func_id ] = func
530+
531+ self .call_relationships .extend (relationships )
532+ except Exception :
533+ logger .exception (f"Failed to analyze Scala file { file_path } " )
534+
511535 def _resolve_call_relationships (self ):
512536 """
513537 Resolve function call relationships across all languages.
@@ -804,6 +828,8 @@ def _generate_visualization_data(self) -> dict:
804828 node_classes .append ("lang-php" )
805829 elif file_ext == ".rb" :
806830 node_classes .append ("lang-ruby" )
831+ elif file_ext in [".scala" , ".sc" ]:
832+ node_classes .append ("lang-scala" )
807833
808834 cytoscape_elements .append (
809835 {
0 commit comments