Skip to content
vic

xuwei-k/unused-code

find and remove unused scala code

xuwei-k/unused-code.json
{
"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"
}

maven scaladoc

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

addSbtPlugin("com.github.xuwei-k" % "unused-code-plugin" % "version")
> unusedCode
> scalafix WarnUnusedCode
> scalafix RemoveUnusedCode

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