- Home
- Code Refactoring Tools
- Scalafix
Scalafix
Lausanne, Switzerland
What it is
Scalafix is a free Scala refactoring and linting tool for automating code-health work and one-time migrations. It reports patterns that may lead to production bugs or violate coding style, and it can enforce rules during code review. Its check option fails when fixes or linting are required. Syntactic rules inspect source without compilation; semantic rules use compiled sources with the SemanticDB compiler plugin enabled, and some also need compiler options such as unused-import warnings. Built-in rules include OrganizeImports, RemoveUnused, DisableSyntax, ProcedureSyntax, and RedundantSyntax. Developers can create custom linter and rewrite rules through the public API. The official integration supports sbt, while documentation lists externally maintained integrations for scala-cli, Mill, Gradle, Maven, and Mega-Linter. Mega-Linter supports only built-in syntactic rules. Scalafix is tested on macOS, Linux, and Windows. Listed tested Scala versions are 2.12.21, 2.13.18, and 3.9.0 LTS; it is no longer published for Scala 2.11.
For and against
For
- Free plan
- Automates refactoring and migration tasks
- Custom rules through public API
- Code-review enforcement with check option
- Supports macOS, Linux, and Windows
Against
- Semantic rules require SemanticDB compilation
- Mega-Linter allows only built-in syntactic rules
- No Scala 2.11 publication
- sbt 0.13.x is no longer supported
The verdict
Scalafix combines linting, automated rewrites, migration scripts, and review-time enforcement for Scala projects. Check the compiler, Scala, and build-tool requirements before adopting it.
Who it suits
Scalafix suits Scala developers and teams maintaining code quality or performing migrations. It is relevant when projects use sbt or one of the listed external integrations and supported Scala versions.
On the record
- Build integration
- The official sbt plugin supports running rules across project configurations and main and test sources.scalacenter.github.io · read 3 Oct 2026
- Build tools
- The documentation describes sbt support and lists externally maintained integrations for scala-cli, Mill, Gradle, Maven, and Mega-Linter.scalacenter.github.io · read 2 Oct 2026
- Built-in rules
- The built-in rule list includes RemoveUnused, OrganizeImports, ExplicitResultTypes, and DisableSyntax.scalacenter.github.io · read 3 Oct 2026
- CI
- Scalafix can enforce refactoring and linting rules during code review.scalacenter.github.io · read 2 Oct 2026
- CI enforcement
- Scalafix can enforce refactoring and linting rules on code reviews, and its --check option fails when fixes or linting are needed.scalacenter.github.io · read 3 Oct 2026
- Community support
- The project links to community discussion on Discord and Scala Users.scalacenter.github.io · read 3 Oct 2026
- Custom rules
- Users can create custom linter and rewrite rules using the Scalafix public API.scalacenter.github.io · read 3 Oct 2026
- Linting
- It reports errors for code patterns that can cause production bugs or violate coding style.scalacenter.github.io · read 3 Oct 2026
- Maker
- The project site identifies Scala Center in its copyright notice.scalacenter.github.io · read 3 Oct 2026
- Mega-Linter limit
- The Mega-Linter integration supports only built-in syntactic rules.scalacenter.github.io · read 2 Oct 2026
- Other build tools
- The documentation lists externally maintained support for scala-cli, Mill, Gradle, Maven, and Mega-Linter; Mega-Linter supports only built-in syntactic rules.scalacenter.github.io · read 3 Oct 2026
- Purpose
- Scalafix is a refactoring and linting tool for Scala.scalacenter.github.io · read 3 Oct 2026
- Refactoring
- It can automate day-to-day code health tasks and one-time migration scripts.scalacenter.github.io · read 3 Oct 2026
- Rule types
- It supports syntactic rules that can run without compilation and semantic rules that require SemanticDB compiler output.scalacenter.github.io · read 3 Oct 2026
- Scala support
- The installation guide lists Scala 2.12.21, 2.13.18, and 3.9.0 LTS as tested versions and says Scalafix is no longer published for Scala 2.11.scalacenter.github.io · read 2 Oct 2026
- Semantic rule requirement
- Semantic rules require source files compiled with SemanticDB, and some rules also require compiler options such as unused-import warnings.scalacenter.github.io · read 2 Oct 2026
- Support and community
- The Scalafix site links to community help on Discord and Scala Users.scalacenter.github.io · read 2 Oct 2026
- Supported operating systems
- Scalafix is tested to work on macOS, Linux, and Windows; other setups may work but could behave unexpectedly.scalacenter.github.io · read 2 Oct 2026