mirror of https://github.com/sbt/sbt.git
**Problem** Setting `Global / autoStartServer := false` in global.sbt triggers a spurious lintUnused warning, even though the setting is correctly used by sbt's server startup logic. **Solution** Add `autoStartServer` to the `excludeLintKeys` set in LintUnused.scala, similar to other server-related settings like `serverConnectionType` and `serverIdleTimeout`. This prevents the warning while maintaining the functionality of the setting.
This commit is contained in:
parent
4681dc714c
commit
f6f00c1931
|
|
@ -29,6 +29,7 @@ object LintUnused {
|
|||
},
|
||||
excludeLintKeys := Set(
|
||||
aggregate,
|
||||
autoStartServer,
|
||||
concurrentRestrictions,
|
||||
commands,
|
||||
configuration,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
// Test for issue #6624: autoStartServer should not trigger lintUnused warning
|
||||
Global / autoStartServer := false
|
||||
|
||||
@transient
|
||||
lazy val check = taskKey[Unit]("")
|
||||
|
||||
lazy val root = (project in file("."))
|
||||
.settings(
|
||||
check := Def.uncached {
|
||||
val state = Keys.state.value
|
||||
val includeKeys = (Global / lintIncludeFilter).value
|
||||
val excludeKeys = (Global / lintExcludeFilter).value
|
||||
val result = sbt.internal.LintUnused.lintUnused(state, includeKeys, excludeKeys)
|
||||
// autoStartServer should not appear in the lint results
|
||||
val autoStartServerWarnings = result.filter { case (_, key, _) =>
|
||||
key.contains("autoStartServer")
|
||||
}
|
||||
assert(
|
||||
autoStartServerWarnings.isEmpty,
|
||||
s"autoStartServer should not trigger lintUnused warnings, but found: ${autoStartServerWarnings.map(_._2).mkString(", ")}"
|
||||
)
|
||||
}
|
||||
)
|
||||
|
|
@ -0,0 +1 @@
|
|||
> check
|
||||
Loading…
Reference in New Issue