mirror of https://github.com/sbt/sbt.git
Only print unused setting warning if there are any
This commit is contained in:
parent
181bfe8a46
commit
805fa002a7
|
|
@ -70,26 +70,29 @@ object LintUnused {
|
||||||
import scala.collection.mutable.ListBuffer
|
import scala.collection.mutable.ListBuffer
|
||||||
val buffer = ListBuffer.empty[String]
|
val buffer = ListBuffer.empty[String]
|
||||||
|
|
||||||
val size = result.size
|
if (result.isEmpty) Vector.empty
|
||||||
if (size == 1) buffer.append("there's a key that's not used by any other settings/tasks:")
|
else {
|
||||||
else buffer.append(s"there are $size keys that are not used by any other settings/tasks:")
|
val size = result.size
|
||||||
buffer.append(" ")
|
if (size == 1) buffer.append("there's a key that's not used by any other settings/tasks:")
|
||||||
result foreach {
|
else buffer.append(s"there are $size keys that are not used by any other settings/tasks:")
|
||||||
case (_, str, positions) =>
|
buffer.append(" ")
|
||||||
buffer.append(s"* $str")
|
result foreach {
|
||||||
positions foreach {
|
case (_, str, positions) =>
|
||||||
case pos: FilePosition => buffer.append(s" +- ${pos.path}:${pos.startLine}")
|
buffer.append(s"* $str")
|
||||||
case _ => ()
|
positions foreach {
|
||||||
}
|
case pos: FilePosition => buffer.append(s" +- ${pos.path}:${pos.startLine}")
|
||||||
|
case _ => ()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
buffer.append(" ")
|
||||||
|
buffer.append(
|
||||||
|
"note: a setting might still be used by a command; to exclude a key from this `lintUnused` check"
|
||||||
|
)
|
||||||
|
buffer.append(
|
||||||
|
"either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key"
|
||||||
|
)
|
||||||
|
buffer.toVector
|
||||||
}
|
}
|
||||||
buffer.append(" ")
|
|
||||||
buffer.append(
|
|
||||||
"note: a setting might still be used by a command; to exclude a key from this `lintUnused` check"
|
|
||||||
)
|
|
||||||
buffer.append(
|
|
||||||
"either append it to `Global / excludeLintKeys` or call .withRank(KeyRanks.Invisible) on the key"
|
|
||||||
)
|
|
||||||
buffer.toVector
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def lintUnused(
|
def lintUnused(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue