diff --git a/main/src/main/scala/sbt/internal/LintUnused.scala b/main/src/main/scala/sbt/internal/LintUnused.scala index 6f78f3fc4..936caf31d 100644 --- a/main/src/main/scala/sbt/internal/LintUnused.scala +++ b/main/src/main/scala/sbt/internal/LintUnused.scala @@ -29,6 +29,7 @@ object LintUnused { }, excludeLintKeys := Set( aggregate, + autoStartServer, concurrentRestrictions, commands, configuration, diff --git a/sbt-app/src/sbt-test/project/lint-autostartserver/build.sbt b/sbt-app/src/sbt-test/project/lint-autostartserver/build.sbt new file mode 100644 index 000000000..974058aa8 --- /dev/null +++ b/sbt-app/src/sbt-test/project/lint-autostartserver/build.sbt @@ -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(", ")}" + ) + } + ) diff --git a/sbt-app/src/sbt-test/project/lint-autostartserver/test b/sbt-app/src/sbt-test/project/lint-autostartserver/test new file mode 100644 index 000000000..15675b169 --- /dev/null +++ b/sbt-app/src/sbt-test/project/lint-autostartserver/test @@ -0,0 +1 @@ +> check