Skip to content

xuwei-k/unused-code

Repository files navigation

Unused Code

maven scaladoc

find and warn, remove unused public classes, methods by scalafix SyntacticRule.

setup

project/plugins.sbt

addSbtPlugin("com.github.xuwei-k" % "unused-code-plugin" % "version")

sbt shell

> unusedCode
> scalafix WarnUnusedCode
> scalafix RemoveUnusedCode

config example

build.sbt

import scala.concurrent.duration.*

ThisBuild / unusedCodeConfig ~= { c =>
  c.copy(
    excludeNameRegex = Set(
      ".*Server"
    ),
    excludePath = c.excludePath ++ Set(
      "glob:some-project/**"
    ),
    excludeGitLastCommit = Some(
      365.days
    ),
    excludeMainMethod = false,
    dialect = unused_code.Dialect.Scala3,
  )
}