mirror of https://github.com/sbt/sbt.git
Override filter method on the FilteringReporter
This commit is contained in:
parent
22d12f6618
commit
587d821828
|
|
@ -72,13 +72,22 @@ private[sbt] object SbtParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override def warning(pos: Position, msg: String): Unit =
|
// weird hack to make sure errors are counted by the underlying
|
||||||
getReporter(pos.source.file.name).warning(pos, msg)
|
// reporters in both Scala 2.12 and 2.13.x
|
||||||
|
|
||||||
// error must be overridden to increment the error counts
|
|
||||||
// see https://github.com/scala/bug/issues/12317
|
// see https://github.com/scala/bug/issues/12317
|
||||||
override def error(pos: Position, msg: String): Unit =
|
override def filter(pos: Position, msg: String, severity: Severity): Int = {
|
||||||
getReporter(pos.source.file.name).error(pos, msg)
|
val reporter = getReporter(pos.source.file.name)
|
||||||
|
val result = reporter.filter(pos, msg, severity)
|
||||||
|
if (result <= 1) reporter.increment(severity)
|
||||||
|
if (result == 0) reporter.doReport(pos, msg, severity)
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
|
override def hasErrors: Boolean = {
|
||||||
|
var result = false
|
||||||
|
reporters.forEachValue(100, r => if (r.hasErrors) result = true)
|
||||||
|
result
|
||||||
|
}
|
||||||
|
|
||||||
def createReporter(uniqueFileName: String): StoreReporter = {
|
def createReporter(uniqueFileName: String): StoreReporter = {
|
||||||
val r = new StoreReporter(settings)
|
val r = new StoreReporter(settings)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue