A simple plugin that makes the error reporter a bit more concise.
I find it useful when doing refactoring: I get a lot of compilation errors, and I waste a lot of time switching between files and looking for line numbers in the error message, when I can immediately see what's wrong when looking at the faulty line.
This plugin helps by summarizing all the errors per file.
Side by side comparison (this plugin on the left, origin on the right):
[info] Compiling 2 Scala sources to /Users/martin/Desktop/foo/target/scala-2.12/classes...
[error] [E1] src/main/scala/Bar.scala
[error] type mismatch;
[error] found : String("")
[error] required: Int
[error] L2: val x: Int = ""
[error] L2: ^
[warn] [E2] src/main/scala/Bar.scala
[warn] @deprecated now takes two arguments; see the scaladoc.
[warn] L4: @deprecated
[warn] L4: ^
[error] [E3] src/main/scala/Foo.scala
[error] not found: value foobar
[error] L2: def foo: String = foobar
[error] L2: ^
[error] src/main/scala/Bar.scala: L2 [E1], L4 [E2]
[error] src/main/scala/Foo.scala: L2 [E3]
[info] Legend: Ln = line n, Cn = column n, En = error n
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 0 s, completed Jul 3, 2017 3:00:27 PM
To enable this plugin globally, simply put the following in
~/.sbt/1.0/plugins/plugins.sbt
:
addSbtPlugin("com.github.duhemm" % "sbt-errors-summary" % "0.6.5")
The organization has changed between 0.6.3 and 0.6.4. Please update!
You can also enable it for a specific project by putting the same line in
project/plugins.sbt
in your sbt project.
The last version of this plugin to support sbt 0.13 is 0.6.0.
To enable this plugin globally, simply put the following in
~/.sbt/1.0/plugins/plugins.sbt
:
addSbtPlugin("org.duhemm" % "sbt-errors-summary" % "0.6.0")
You can also enable it for a specific project by putting the same line in
project/plugins.sbt
in your sbt project.
This reporter supports several configuration options that let you change how errors
are reported. The configuration can be accessed via the reporterConfig
setting key.
A configuration is represented by an instance of a ReporterConfig
, which is
generated from a Contraband schema.
The examples can be copy pasted directly inside you global settings in sbt (~/.sbt/1.0/global.sbt
)
or inside your build definition. If you enabled this plugin globally and want to configure it globally,
you'll also need to add the following import:
import sbt.errorssummary.Plugin.autoImport._
or start sbt with sbt.global.autoimport
set to true
.
The supported configuration options include:
colors: Boolean = true
:
Determines whether the reporter will produce a colored and formatted (as in bold,
underlined, etc.) output. Defaults to true
.
Example:
reporterConfig := reporterConfig.value.withColors(false)
All the colors are configurable. See ReporterConfig.contra to see all the existing configuration keys.
shortenPaths: Boolean = true
:
Determines whether the reporter will strip the current working directory from paths
it displays. Defaults to true
.
Example:
reporterConfig := reporterConfig.value.withShortenPaths(false)
Note (0.6.4+): For compatibility with IntelliJ and ENSIME's sbt-mode, the paths will never be shortened when:
idea.run
is set, orINSIDE_EMACS
is set, orsbt.errorssummary.full.paths
is set.columnNumbers: Boolean = false
:
Determines whether the reporter will show the column number at which an error has been
recorded, Defaults to false
.
Example:
reporterConfig := reporterConfig.value.withColumnNumbers(false)
reverseOrder: Boolean = false
:
Determines whether the reproter will show the error messages in reverse order (first error
displayed at the bottom of the screen.) Defaults to false
.
Example:
reporterConfig := reporterConfig.value.withReverseOrder(false)
showLegend: Boolean = true
:
Determines whether to show a legend at the bottom for the various
types of numbers (line, column, error). Note that despite this
setting, a legend will still only be shown if there actually are
errors, and not otherwise.
Example:
reporterConfig := reporterConfig.value.withShowLegend(false)
Information is available in the contributing guide
The current maintainers (people who can merge pull requests) are:
com.github.duhemm
. Please update your
plugins accordingly.reporterConfig
key to configure the reporter. See examples in previous section.ReporterConfig
to configure how the reporter displays error messages in
#15printWarnings
task in #18