Back to directory
xuwei-k avatar

unused-code

find and remove unused scala code. Read more below about its uses, features, and usage.

Clone repository

git clone https://github.com/xuwei-k/unused-code.git

77

Stars

3

Forks

3

Watchers

MIT

License

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

and then

> scalafix WarnUnusedCode

or

> scalafix ErrorUnusedCode

or

> 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,
  )
}