Skip to content

Commit f24d0d6

Browse files
Respect scalafmt fatalWarnings config (higherkindness#281)
1 parent 383db25 commit f24d0d6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

rules/scalafmt/scalafmt/ScalafmtRunner.scala

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ object ScalafmtRunner extends WorkerMain[Unit] {
3939
format(source)
4040
} catch {
4141
case e @ (_: org.scalafmt.Error | _: scala.meta.parsers.ParseException) => {
42-
System.err.println(Color.Warning("Unable to format file due to bug in scalafmt"))
43-
System.err.println(Color.Warning(e.toString))
44-
source
42+
if (config.runner.fatalWarnings) {
43+
System.err.println(Color.Error("Exception thrown by Scalafmt and fatalWarnings is enabled"))
44+
throw e
45+
} else {
46+
System.err.println(Color.Warning("Unable to format file due to bug in scalafmt"))
47+
System.err.println(Color.Warning(e.toString))
48+
source
49+
}
4550
}
4651
}
4752

0 commit comments

Comments
 (0)