Duhemm / sbt-errors-summary

sbt plugin to show a summary of compilation messages.
MIT License
201 stars 11 forks source link

sbt-errors-summary

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.

Overview

This plugin helps by summarizing all the errors per file.

Side by side comparison (this plugin on the left, origin on the right):

side-by-side.png

[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

Installation

sbt 1.0 or later

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.

sbt 0.13

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.

Configuration

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:

Contributing

Information is available in the contributing guide

Maintainers

The current maintainers (people who can merge pull requests) are:

Changelog

0.6.5

0.6.3

0.6.0

0.5.0

0.4.1

0.4.0

0.3.0

0.2.0

0.1.0