Add Scala support to repository analysis - #108
Merged
Merged
Conversation
Collaborator
|
Thank you very much @mageshwaranr. Merged! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds Scala support, addresses #105.
How
New
analyzers/scala.pyfollowing the same tree-sitter pattern as the Kotlin/Rubyanalyzers:
enums, methods, and top-level functions. Uses a two-level
component_type/node_typesplit —component_typeis the coarse type the pipeline gates leafselection on (traits →
interface, objects →class, so both stay leaf-eligible andcount toward the issue-C/C++ repository collapses to 5 leaf nodes during dependency analysis. Silent fallback to whole-repository mode #75 OOP heuristic), while
node_type/display_namepreservethe faithful Scala construct (
trait,object,enum). This avoids widening theshared
OOP_TYPESset, which would change documentation output for PHP/Kotlin/C++ asa side effect — a decision left for its own change.
$-suffixed component id (buffer.scala::Buffervs.buffer.scala::Buffer$), mirroring Scala's own JVM encoding of module classes, so aclass and its same-named companion never displace each other.
(including Scala 3 parameterized traits), instantiation, and method calls — resolving
intra-file targets against a same-file symbol table and leaving external targets as
unresolved logical names. A curated primitive/stdlib-call exclusion set (mirroring the
Kotlin/PHP precedent) keeps
Int,List,.map,.size, etc. out of the graph.build.sbtandproject/*.sbtclassify as buildmanifest/artifact files (alongside the existing Maven/Gradle handling) rather than
being parsed as application source;
.sbtis deliberately never added toCODE_EXTENSIONS.Registration follows the Ruby/Kotlin precedent end-to-end: both language whitelists in
analysis_service.py, the dispatcher branch +lang-scalacytoscape class incall_graph_analyzer.py,.scmapping and Scala function patterns inpatterns.py,module-path stripping in
ast_parser.py, the source-extension set inartifact.py, thecode-fence language map in
prompt_template.py, CLI repo validation and languagedetection, and MCP incremental-change detection.
Dependency note: pins
tree-sitter-scala==0.23.4, not the newer 0.26.2. Verifiedempirically that 0.24.0+ compiles against grammar ABI 15, which raises
Incompatible Language version 15under this repo'stree-sitter==0.23.2core pin —declared package metadata (
tree-sitter~=0.22) doesn't reflect the actual compiled ABI.0.23.4 is the last ABI-14 release and is node-for-node identical to 0.26.2 for every
construct the analyzer reads (verified by diffing field-annotated parse trees), so no
tree-sittercore bump is needed for this change.Tests
tests/test_scala_analyzer.py(11 tests): component extraction (classes, traits,objects, companion
$suffix, docstrings, parameters including curried parametergroups), relationship extraction (resolved/unresolved inheritance and mixins,
constructor-parameter edges including Scala 3 parameterized traits, intra-file calls,
unresolved external calls across all three fallback paths, stdlib-noise exclusion),
Scala 3 enum/significant-indentation syntax, sbt artifact classification,
.scextension end-to-end, empty-file handling, and a
DependencyParserend-to-end testproving the whitelist/dispatcher wiring and cross-file inheritance resolution.
Full existing suite (110 tests) passes with no regressions in the Python, Kotlin, PHP,
Ruby, or artifact analyzer tests.
ruff check/ruff format --checkclean on everytouched file.
🤖 Generated with Claude Code