https://github.com/xuwei-k/unused-code
find and remove unused scala code
https://github.com/xuwei-k/unused-code
sbt-plugin scala scalafix-rule
Last synced: 27 days ago
JSON representation
find and remove unused scala code
- Host: GitHub
- URL: https://github.com/xuwei-k/unused-code
- Owner: xuwei-k
- License: mit
- Created: 2022-02-12T08:54:28.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-25T03:33:16.000Z (about 1 month ago)
- Last Synced: 2025-04-02T09:08:39.526Z (about 1 month ago)
- Topics: sbt-plugin, scala, scalafix-rule
- Language: Scala
- Homepage:
- Size: 104 KB
- Stars: 72
- Watchers: 6
- Forks: 4
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Unused Code
[](https://search.maven.org/artifact/com.github.xuwei-k/unused-code-scalafix_2.13)
[](https://javadoc.io/doc/com.github.xuwei-k/unused-code-scalafix_2.13/latest/unused_code/index.html)find and warn, remove unused public classes, methods by scalafix SyntacticRule.
## setup
### `project/plugins.sbt`
```scala
addSbtPlugin("com.github.xuwei-k" % "unused-code-plugin" % "version")
```### sbt shell
```
> unusedCode
> scalafix WarnUnusedCode
> scalafix RemoveUnusedCode
```### config example
`build.sbt`
```scala
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,
)
}
```