Languages / Scala

Scala code analysis: call graphs, complexity and dead code

For unused imports and locals in Scala, the compiler's -Wunused flags and Scalafix RemoveUnused are the standard tools. repowise adds a repository-wide call graph shared with Java, health scores per file, performance markers such as Await.result inside Future code, and git history. Every Scala dead-code finding is ranked with a confidence and an owner.

Last reviewed: November 2026

Full tier

What repowise detects in Scala

Checked against the engine source. Every row runs locally with zero LLM calls.

repowise capabilities for Scala
Files parsed.scala
Import resolutionPartial. Shared JVM index with Java, wildcard and rename imports, sbt and Mill build fallback; implicit-heavy code is kept live
Call graphYes
Dead codeReported as review findings with confidence, reason and owner
Health markersComplexity, class metrics, Extract Method plans
Performance markers"...".r regex built per iteration, Await.result inside a Future-returning def, I/O and locks in loops
Coverage reportsCobertura from scoverage, JaCoCo
Frameworks recognisedNo Scala-specific framework edges

Specific to this language

How Scala code is read

How Scala imports resolve

repowise resolves explicit imports, wildcards and rename imports through the shared JVM index. Implicits and givens decide much of what a Scala file uses, so implicit-heavy code is kept live and each finding is ranked with a confidence.

Dead code is advisory here

Languages without full import resolution never get the deletion-ready flag. Scala findings are a review list: useful for a cleanup sweep, not something an agent should delete unattended.

Scala-specific markers

"...".r compiles a regex each time it runs, so it is flagged inside loops. Await.result inside a def whose declared return type is Future blocks a thread. .map and .foreach lambdas reset loop depth, so only while, do-while and for-comprehensions count as loops: a stated ceiling.

Honest comparison

Native Scala tools, and when they are enough

Native Scala analysis tools
ToolWhat it covers
scalac -WunusedUnused imports, privates, locals and parameters, from the compiler.
ScalafixRemoveUnused rewrites and custom lint rules.
WartRemoverCompiler-plugin linting for unsafe patterns.
sbt-scoverageStatement and branch coverage; writes Cobertura XML.

Where repowise adds value

  • A call graph and dependency map across Scala and Java modules, with C4 views.
  • Health per file combining complexity, churn and coverage, plus Future and regex performance markers.
  • Hotspots, ownership and co-change from git history.

How to run it

Analyse a Scala repository

From the repository root. Agents get the same results through the get_dead_code, get_health and get_context MCP tools.

uv tool install repowise        # or: pipx install repowise
repowise init --yes --no-prose     # index the repo, no API key
repowise dead-code --min-confidence 0.7 --safe-only
repowise health --refactoring-targets
sbt coverage test coverageReport
repowise coverage add target/scala-<version>/coverage-report/cobertura.xml
repowise serve                     # graph, health and dead code in a local dashboard

Questions

What people ask before they try it.

Can repowise find dead code in Scala?

Yes. repowise reports unused Scala code as review findings with a confidence, a reason and the file's owner, ranked by git history. scalac -Wunused and Scalafix make a good compiler-side companion.

Does it work with sbt and Mill?

Yes. Source roots come from build.sbt or build.sc when the standard layout is not enough.

Can it map a mixed Scala and Java codebase?

Yes. Scala and Java resolve through one JVM index, so calls between them are edges in the same graph.

Does repowise send my Scala code to an LLM?

No. Parsing, the call graph, dead code, health scores, performance markers and git history all run locally with zero LLM calls. repowise init --yes --no-prose needs no API key, and the analysis itself makes no network calls. Written documentation prose is the one opt-in step that uses a model, and it can run on a local Ollama model.

Index a Scala repository.

Public repositories are free on repowise.dev. The CLI is open source and runs on your machine with no API key.