joan38 / mill-scalafix

A Scalafix plugin for Mill build tool

GitHub

mill-scalafix

Latest version

A scalafix plugin for Mill build tool.

Usage

Fix sources

build.sc:

import $ivy.`com.goyeau::mill-scalafix:<latest version>`
import com.goyeau.mill.scalafix.ScalafixModule
import mill.scalalib._

object project extends ScalaModule with ScalafixModule {
  def scalaVersion = "2.12.11"
}
> mill project.fix
[29/29] project.fix
/project/project/src/MyClass.scala:12:11: error: [DisableSyntax.var] mutable state should be avoided
  private var hashLength = 7
          ^^^
1 targets failed
mill-git.fix A Scalafix linter error was reported

Scalafix Arguments

mill-scalafix takes any argument that can be passed to the Scalafix the command line tool.
You could for example check that all files have been fixed with scalafix. We usually use that to enforce rules in CI:

> mill project.fix --check
[30/30] project.fix 
--- /project/project/src/Fix.scala
+++ <expected fix>
@@ -1,3 +1,3 @@
 object Fix {
-  def procedure() {}
+  def procedure(): Unit = {}
 }
1 targets failed
project.fix A Scalafix test error was reported. Run `fix` without `--check` or `--diff` to fix the error

Related projects

Contributing

Contributions are more than welcome!
See CONTRIBUTING.md for all the information and getting help.