Skip to content

xuwei-k/unused-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

11b0ef2 · Mar 21, 2025
Jan 10, 2025
Jan 15, 2025
Feb 24, 2025
Jan 10, 2025
Mar 17, 2025
Feb 14, 2022
Mar 12, 2025
Feb 12, 2022
Feb 14, 2023
Mar 21, 2025
Feb 24, 2025

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