Freedom251 › Code Refactoring Tools
Scalafix

What Scalafix is
Scalafix is a free Scala refactoring and linting tool for code-health work and one-time migrations. It can report patterns associated with production bugs or style violations, and teams can enforce rules during code review; its check option fails when linting or fixes are needed. Syntactic rules operate on source code without compilation, while semantic rules need compiled sources with the SemanticDB compiler plugin enabled. Built-in rules include OrganizeImports, RemoveUnused, DisableSyntax, ProcedureSyntax, and RedundantSyntax. Developers can create custom lint and rewrite rules through its public API. The official build integration is for sbt, whose plugin can run rules across project configurations and main and test sources. Documentation also 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, with listed tested Scala versions 2.12.21, 2.13.18, and 3.9.0 LTS. It is no longer published for Scala 2.11 or sbt 0.13.x.
Who it suits
Scalafix suits Scala developers and teams that want automated linting, refactoring, or migration rules in their projects and code review process. Users of semantic rules need compiled sources and SemanticDB enabled.
What it does well
- Free tool for Scala refactoring and linting.
- Syntactic rules do not require compilation.
- Supports custom lint and rewrite rules.
- Can enforce checks during code review.
- Tested on macOS, Linux, and Windows.
What to know first
- No longer published for Scala 2.11.
- sbt-scalafix is no longer published for sbt 0.13.x.
- Semantic rules require SemanticDB-compiled sources.
- Mega-Linter integration supports only built-in syntactic rules.
Getting started
- Visit the Scalafix website and choose the integration for your build tool.
- For the official integration, use the sbt plugin.
- Choose built-in rules or write custom lint and rewrite rules with the public API.
- For semantic rules, compile sources with the SemanticDB compiler plugin enabled.
- Use Scalafix in code review and the --check option to fail when fixes or linting are needed.
Verdict
Scalafix offers rule-based linting and rewrites for Scala, with both syntactic and semantic approaches. Check the Scala and build-tool version limits, and the additional setup required for semantic rules.
Questions
How much does Scalafix cost?
Scalafix is free.
Which languages and versions does it support?
It is a Scala tool. The installation guide lists Scala 2.12.21, 2.13.18, and 3.9.0 LTS as tested versions; Scalafix is no longer published for Scala 2.11.
Which operating systems does Scalafix support?
It is tested to work on macOS, Linux, and Windows.
Which build tools can I use with Scalafix?
The official integration is for sbt. Documentation also lists externally maintained integrations for scala-cli, Mill, Gradle, Maven, and Mega-Linter; Mega-Linter supports only built-in syntactic rules.
Do semantic rules need a special setup?
Yes. Semantic rules require compiled sources with the SemanticDB compiler plugin enabled. Some rules also need compiler options such as unused-import warnings.
Who makes Scalafix?
The Scala Center describes itself as an independent not-for-profit center established at EPFL and focused on open source and education.
Facts from Scalafix's own pages
- Build integration
- The official sbt plugin supports running rules across project configurations and main and test sources. · scalacenter.github.io, 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, 2 Oct 2026
- Built-in rules
- The built-in rule list includes RemoveUnused, OrganizeImports, ExplicitResultTypes, and DisableSyntax. · scalacenter.github.io, 3 Oct 2026
- CI
- Scalafix can enforce refactoring and linting rules during code review. · scalacenter.github.io, 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, 3 Oct 2026
- Community support
- The project links to community discussion on Discord and Scala Users. · scalacenter.github.io, 3 Oct 2026
- Custom rules
- Users can create custom linter and rewrite rules using the Scalafix public API. · scalacenter.github.io, 3 Oct 2026
- Founded
- 2016 · scalacenter.github.io, 28 Sept 2026
- Headquarters
- Lausanne, Switzerland · scalacenter.github.io, 28 Sept 2026
- Linting
- It reports errors for code patterns that can cause production bugs or violate coding style. · scalacenter.github.io, 3 Oct 2026
- Maker
- The project site identifies Scala Center in its copyright notice. · scalacenter.github.io, 3 Oct 2026
- Mega-Linter limit
- The Mega-Linter integration supports only built-in syntactic rules. · scalacenter.github.io, 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, 3 Oct 2026
- Purpose
- Scalafix is a refactoring and linting tool for Scala. · scalacenter.github.io, 3 Oct 2026
- Refactoring
- It can automate day-to-day code health tasks and one-time migration scripts. · scalacenter.github.io, 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, 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, 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, 2 Oct 2026
- Support and community
- The Scalafix site links to community help on Discord and Scala Users. · scalacenter.github.io, 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, 2 Oct 2026
- Supported systems
- Scalafix is tested on macOS, Linux, and Windows. · scalacenter.github.io, 3 Oct 2026
- Version limits
- The documentation says Scalafix is no longer published for Scala 2.11 and sbt-scalafix is no longer published for sbt 0.13.x. · scalacenter.github.io, 3 Oct 2026
Where Scalafix stands on Freedom251
- Code Refactoring Tools#19 of 22