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