Skip to content

Commit

Permalink
ScalafmtSbtReporter: mention scalafmt in messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Albert Meltzer authored and kitbellew committed Dec 2, 2021
1 parent 5853283 commit f885ba6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import sbt.librarymanagement.MavenRepository
import sbt.util.CacheImplicits._
import sbt.util.CacheStoreFactory
import sbt.util.FileInfo
import sbt.util.Level

import scala.util.Failure
import scala.util.Success
Expand Down Expand Up @@ -113,6 +114,13 @@ object ScalafmtPlugin extends AutoPlugin {
val diffRefPrefix = "diff-ref="
}

private class ScalafmtLogger(log: Logger) extends Logger {
override def trace(t: => Throwable): Unit = log.trace(t)
override def success(message: => String): Unit = success(message)
override def log(level: Level.Value, message: => String): Unit =
log.log(level, "scalafmt: " + message)
}

private class FormatSession(
config: Path,
taskStreams: TaskStreams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class ScalafmtSbtReporter(
override def error(file: Path, message: String, e: Throwable): Unit = {
def getMessage() = {
val res = new StringWriter()
res.write("scalafmt: ")
res.write(Option(message).getOrElse("failed"))
res.write(" [")
res.write(file.toString)
Expand Down

0 comments on commit f885ba6

Please sign in to comment.