xplosunn / forceoverrides   0.0.3

GitHub

Scalafix rule to force explicit overriding

Scala versions: 2.13 2.12

ForceOverrides

Scalafix rule to force explicit overriding.

Given the following example:

trait Printer {
  def print(s: String): Unit
}

object StdOut extends Printer {
  def print(sx: String): Unit = System.out.print(sx)
}

This rule re-writes the code to:

trait Printer {
  def print(s: String): Unit
}

object StdOut extends Printer {
  override def print(sx: String): Unit = System.out.print(sx)
}

Usage

Add to build.sbt:

ThisBuild / scalafixDependencies += "com.github.xplosunn" %% "ForceOverrides" % "0.0.3"

Add to .scalafix.conf:

fix.ForceOverrides