xuwei-k/unused-code
find and remove unused scala code
{ "createdAt": "2022-02-12T08:54:28Z", "defaultBranch": "main", "description": "find and remove unused scala code", "fullName": "xuwei-k/unused-code", "homepage": "", "language": "Scala", "name": "unused-code", "pushedAt": "2025-11-26T21:56:35Z", "stargazersCount": 74, "topics": [ "sbt-plugin", "scala", "scalafix-rule" ], "updatedAt": "2025-11-26T21:56:39Z", "url": "https://github.com/xuwei-k/unused-code"}Unused Code
Section titled “Unused Code”find and warn, remove unused public classes, methods by scalafix SyntacticRule.
project/plugins.sbt
Section titled “project/plugins.sbt”addSbtPlugin("com.github.xuwei-k" % "unused-code-plugin" % "version")sbt shell
Section titled “sbt shell”> unusedCode> scalafix WarnUnusedCode> scalafix RemoveUnusedCodeconfig example
Section titled “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, )}