Scala Code Analysis

Analysis of Scala applications, Akka systems, Spark pipelines, and Play Framework services

What Axiom Refract Analyzes in Scala

Import and Package Object Resolution

Resolves Scala import statements including wildcard imports, renamed imports, and package object members. Handles Scala 3 export clauses and top-level definitions.

Trait Linearization Mapping

Maps the trait mixin linearization order for complex class hierarchies. Identifies where linearization produces unexpected method resolution that could cause architectural issues.

Implicit and Given Resolution

Tracks implicit parameter chains (Scala 2) and given/using clauses (Scala 3) that create structural dependencies invisible in explicit import analysis.

Actor System Architecture

Maps Akka actor hierarchies, message passing patterns, and supervision strategies. Identifies architectural patterns in actor-based concurrent systems.

How It Works

Scala is parsed using a hand-hardened Tree-sitter grammar supporting both Scala 2.13 and Scala 3 syntax, including union/intersection types, opaque type aliases, extension methods, and indentation-based syntax. The parser resolves SBT build definitions and multi-project build structures for cross-module dependency mapping. Companion object relationships and implicit scope rules are tracked for complete dependency resolution.

Common Findings in Scala Codebases

Implicit Chain Complexity

Scala 2 implicit chains and Scala 3 given instances create hidden dependency paths that are difficult to trace. Axiom maps the implicit resolution graph and identifies long or fragile implicit chains.

Cake Pattern Over-Coupling

The cake pattern (self-type annotations with trait composition) can create tight coupling between components that should be independent. Axiom detects cake pattern usage and analyzes the coupling it creates.

SBT Build Complexity

Complex SBT build definitions with multiple projects, custom tasks, and plugin configurations can become architectural risks themselves. Axiom analyzes build structure alongside application architecture.

Polyglot Support

Scala is one of 145+ languages Axiom Refract supports through Tree-sitter AST parsing. Scala analysis covers build.sbt, project/build.properties, project/plugins.sbt, Mill build files, and Maven/Gradle configurations for Scala projects. Both Scala 2 and Scala 3 syntax are supported simultaneously in mixed-version projects. Your entire codebase is analyzed in a single scan — regardless of how many languages it contains.

Analyze your Scala codebase.