Use lint***Filter instead of ***LintKeys for more reliable test

Below functions pass lintIncludeFilter and lintExcludeFilter to lintUnusedinstead of includeLintKeys and excludeLintKeys respectively.
- sbt.internal.LintUnused#lintUnusedTask
- sbt.internal.LintUnused#lintUnusedFunc
Therefore, in the test, we had better to use lint***Filter instead of ***LintKeys.
This commit is contained in:
Taichi Yamakawa 2020-10-18 18:20:23 +09:00
parent 28833db333
commit 1193f44be2
1 changed files with 6 additions and 2 deletions

View File

@ -2,14 +2,18 @@ ThisBuild / doc / scalacOptions += "-Xsomething"
ThisBuild / shellPrompt := { state => "sbt> " }
// watch related settings
ThisBuild / sbt.nio.Keys.watchTriggers := Seq()
ThisBuild / sbt.nio.Keys.watchPersistFileStamps := true
lazy val lintBuildTest = taskKey[Unit]("")
lazy val root = (project in file("."))
.settings(
lintBuildTest := {
val state = Keys.state.value
val includeKeys = (includeLintKeys in Global).value map { _.scopedKey.key.label }
val excludeKeys = (excludeLintKeys in Global).value map { _.scopedKey.key.label }
val includeKeys = (lintIncludeFilter in Global).value
val excludeKeys = (lintExcludeFilter in Global).value
val result = sbt.internal.LintUnused.lintUnused(state, includeKeys, excludeKeys)
result foreach {
case (_, "ThisBuild / doc / scalacOptions", _) => ()