Giter VIP home page Giter VIP logo

sbt-scapegoat's Introduction

sbt-scapegoat

plugin release badge

sbt-scapegoat is a plugin for SBT that integrates the scapegoat static code analysis library. Find out more about scapegoat at the scapegoat project page.

How to use

sbt-scapegoat is an auto plugin. This means you need SBT 0.13.5 or higher. If you are using an earlier 0.13.x build, you should be able to upgrade to 0.13.5 without any issues.

Please note: scapegoat only works with Scala 2.11.x, 2.12.x, 2.13.x. There are no plans to release a 2.10.x branch.

Another note [scapegoat] Plugin has been migrated to support scala version 2.12.3 and sbt version 1.0.1

Add the plugin to your build with the following in project/plugins.sbt:

addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.2.2") // Verify latest in badge above

The plugin has a default Scapegoat version depending on the Scala version you are using. This version may not always be the latest version of Scapegoat, nor does it always pick a compatible version.

In case you wish to override the version you can do so by setting the scapegoatVersion setting in your build.sbt.

eg.

ThisBuild / scapegoatVersion := "2.1.1"

scapegoat release badge

That's it! You can now generate the scapegoat reports using the scapegoat task:

> scapegoat
[info] [scapegoat] setting output dir to [/home/sam/development/workspace/elastic4s/target/scala-2.11/scapegoat-report]
[info] [scapegoat] disabling inspections: ExpressionAsStatement,VarUse
[info] Compiling 47 Scala sources to /home/sam/development/workspace/elastic4s/target/scala-2.11/classes...
[info] [scapegoat]: 55 activated inspections
[info] [scapegoat]: Beginning anaylsis...
[warn] [scapegoat]: Anaylsis complete - 17 errors; 1 warns 2 infos
[info] [scapegoat]: Written HTML report [/home/sam/development/workspace/elastic4s/target/scala-2.11/scapegoat-report/scapegoat.html]
[info] [scapegoat]: Written XML report [/home/sam/development/workspace/elastic4s/target/scala-2.11/scapegoat-report/scapegoat.xml]

You should find the reports inside target/scala-2.11/scapegoat-report. By default, the reports will be regenerated for all files on every invocation of the scapegoat task. If you'd prefer to only have reports generated for files that have changed between invocations, you can set the scapegoatRunAlways setting to false. You can then manually force a full inspection by invoking the scapegoatClean task, or by doing a full clean.

Inspections list

The full list of inspections can be seen at the scapegoat main page.

Console output

sbt-scapegoat generates three sets of output. HTML and XML reports inside target/scala-2.x/scapegoat-report and also to the console during the build. The latter is useful so you don't have to open up files to see inspection warnings. However you can disable the console output if needed by setting the following key:

import com.sksamuel.scapegoat.sbt.ScapegoatSbtPlugin.autoImport._
scapegoatConsoleOutput := false

Disabling inspections

Sometimes you might want to disable an inspection, should you disagree with it, or have a need to override it completely.

To do this add the following key to your sbt build, and include the simple name of the inspections you wish to disable. (The full names of inspections are displayed in the XML and HTML reports, in this key you include the simple names).

Eg,

scapegoatDisabledInspections := Seq("ExpressionAsStatement", "VarUse")

Ignoring files

Rather that turning off an inspection completely, you might just want to disable scapegoat scanning of a particular file. You can do this with regex matchers on the file path, eg:

scapegoatIgnoredFiles := Seq(".*/SomeScala.scala")

This is a regex that matches on the full path of the file, including what directory it happens to be in. For example, the full path might be /home/sam/development/workspace/scapegoat/scalac-scapegoat-plugin/src/main/scala/com/sksamuel/scapegoat/inspections/VarUse.scala. To exclude this file, we could use a regex like .*/VarUse.scala.

Since this is just regex matching we can do whatever we want - for example we could exclude whole packages, eg .*/com/sksamuel/.* or we could exclude whole src trees, eg .*/src_managed/main/scala/.*

Note: Remember to include the leading .*/ if you are not matching a path as a literal.

Suppressing Warnings by Method or Class

You can suppress a specific warning by method or by class using the java.lang.SuppressWarnings anotation.

Use the simple name of the inspection to be ignored as the argument, or use "all" to suppress all scapegoat warnings in the specified scope.

Some examples:

@SuppressWarnings(Array("all"))
class Test {
  def hello : Unit = {
    val s : Any = "sammy"
    println(s.asInstanceOf[String])
  }
} 

class Test2 {
  @SuppressWarnings(Array("AsInstanceOf"))
  def hello : Unit = {
    val s : Any = "sammy"
    println(s.asInstanceOf[String])
  }
} 

Cross build for Scala 2.11

scapegoatVersion := {
  CrossVersion.partialVersion(scalaVersion.value) match {
    case Some((2, 11)) => "1.4.9"
    case _ => "2.1.1"
  }
}

Inspection warning level overrides

If you want to change the warning level of an inspection, for example to downgrade "TraversableHead" and "OptionGet" from Errors to Warnings, add the following to your build.sbt:

scalacOptions in Scapegoat += "-P:scapegoat:overrideLevels:TraversableHead=Warning:OptionGet=Warning",

The string should be a colon separated list of name=level settings, where 'name' is the simple name of an inspection and 'level' is the simple name of a com.sksamuel.scapegoat.Level constant, e.g. 'Warning'.

False positives

Please note that scapegoat is a new project. While it's been tested on some common open source projects, there is still a good chance you'll find false positives. Please open up issues if you run into these so we can fix them.

Reporting Issues

If you have an error please do report it, but it would be helpful if the issues were logged at the scapegoat issues page, unless the bug is directly related to the plugin. Eg, inspection false positives or false negatives are errors in the scalac compiler plugin, not the sbt plugin.

sbt-scapegoat's People

Contributors

avdv avatar bjaglin avatar chabala avatar ches avatar chocpanda avatar d10xa avatar domdorn avatar eugene-sy avatar gregsymons avatar gsrajesh89 avatar haavardw avatar jiminhsieh avatar johnnei avatar joshrosen avatar kevinmudrick avatar lespea avatar lolgab avatar mccartney avatar miguelangelalvarez avatar mrtnrdl avatar oeuftete avatar pomadchin avatar randomcoder avatar richardbradley avatar rpmr avatar scala-steward avatar sksamuel avatar smashedtoatoms avatar sullis avatar vi-kas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sbt-scapegoat's Issues

False positive null parameter using default namespace in Scala XML

XML like
<DeclareSalary xmlns="http://www.swissdec.ch/schema/sd/20051002/SalaryDeclarationServiceTypes" xmlns:sd="http://www.swissdec.ch/schema/sd/20051002/SalaryDeclaration"

causes the following warning/error:

Null is used as a method parameter: new scala.xml.NamespaceBinding(null, "http://www.swissdec.ch/schema/sd/20051002/SalaryDeclarationServiceTypes", $tmpscope)

Reason is that a default namespace is in fact using a null parameter:
https://github.com/scala/scala-xml/blob/master/src/main/scala/scala/xml/NamespaceBinding.scala

Thus one might argue that is actually not a false positive because the parameter null is actually used, but from an end-user perspective there is no workaround, that is just how the Scala API is.

scapegoat not generating reports

hello, i am trying to use scapegoat with a multi module scala project. i managed to get the dependency resolved. however when i run the scapegoat task i get success and no files get inspected and no report is generated. im using scala 2.11.8 and sbt 0.13.13. this is the output i get:

[info] Done updating.
[info] [scapegoat] setting output dir to [/Users/xx/workspace/xx/target/scala-2.11/scapegoat-report]
[success] Total time: 0 s, completed May 30, 2017 11:31:23 AM

After small test its only inspecting the directory /src/main/scala which is empty. all code exist in separate modules. how i can change scapegoat settings to inspect all modules?

class class without params reports an odd info statement

case class DebuggerShutdownEvent()

reports:

Info Unncessary if condition. com.sksamuel.scapegoat.inspections.unneccesary.UnnecessaryIf
If comparision is not needed. Use the negated condition. Eg, instead of if (a ==b) false else true, simply use !(a == b). : if (x$0.==(null)) false else true

Which has both a spelling mistake Unncessary => Unnecessary and also not something that is user fixable. The correct error is (IMHO) that this should be a case object (working through this as our code has made them harder to remove than they should be).

Allow output in standard formats

The xml output generated at the moment seems to be custom to this project.
It would be useful if it could be in a format that is more Jenkins friendly (checkstyle, findbugs, PMD, etc.)

The checkstyle XmlLogger code is here. It produces something like:

<?xml version="1.0" encoding="UTF-8"?>
<checkstyle version="5.0">
  <file name="C:\Workspace\default_ant\src\org\sprunck\foo\Foo.java">
    <error line="10" message="Line has trailing spaces." severity="error" source="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck"></error>        
    <error line="20" message="Line has trailing spaces." severity="error" source="com.puppycrawl.tools.checkstyle.checks.regexp.RegexpSinglelineCheck"></error>            
    <error column="26" line="30" message="'Went' entspricht nicht dem Muster '^[a-z][a-zA-Z0-9]*$'." severity="error" source="com.puppycrawl.tools.checkstyle.checks.naming.MethodNameCheck"></error>
  </file>
</checkstyle>

scapegoatVersion ignores "in ThisBuild"

In multiproject build I would like to use scapegoatVersion in ThisBuild := "1.3.0" to set it once for all sub-projects. Sadly, this setting is ignored and I have to specify the same setting in all sub-projects. I have to mention it is pretty critical for me. Have you any clue why it behaves like this?

How to run the scapegoat task when compiling the test code

The scapegoat sbt scope extends the compile scope, which to my understanding means that scapegoat will be run against the compile scope and not against the test scope:

val Scapegoat = config("scapegoat") extend Compile

Is there a way to get a scapegoat task that runs when we compile the test code? This might be a feature request.

Do not include scapegoat class files in assembled jar

When I add the scapegoat plugin

addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.4")

Its class files are being included in my assembly when I run sbt assembly.

eg:

assembly
[info] Including from cache: slf4j-api-1.7.5.jar
[info] Including from cache: logback-classic-1.0.13.jar
[info] Including from cache: scaldi_2.11-0.4.jar
[info] Including: scala-xml_2.11-1.0.2.jar
[info] Including from cache: config-1.2.1.jar
[info] Including from cache: scalac-scapegoat-plugin_2.11-1.0.0.jar
[info] Including from cache: logback-core-1.0.13.jar

Issues with cross build `Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml`

I'm having issues with cross build crossScalaVersions := Seq("2.11.11", "2.12.4"),

It gives Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml

I tried excluding it from plugins.sbt like

addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.7"
  exclude("org.scala-lang.modules", "scala-xml"))

Also tried to add exclude("org.scala-lang.modules", "scala-xml") from every library that has scala-xml in it and that also didn't help.

Here is a simplified version of how build.sbt looks like:

scapegoatVersion in ThisBuild := "1.3.4"

lazy val commonSettings = Seq(
  dependencyOverrides += "org.scala-lang" % "scala-compiler" % scalaVersion.value,
  scalacOptions := Seq("-target:jvm-1.8", "-encoding", "utf8", "-feature", "-unchecked", "-deprecation", "-explaintypes", "-Xfatal-warnings"),
  organization := "com.example",
  scalaVersion := "2.12.4",
)

lazy val protocol = (project in file("protocol"))
  .settings(commonSettings)
  .settings(
    crossScalaVersions := Seq("2.11.11", "2.12.4"),
    name := "protocol",
    moduleName := "protocol",
    libraryDependencies ++= Seq(
      "io.circe" %% "circe-java8" % circeVersion,
      "io.circe" %% "circe-generic" % circeVersion,
      "io.circe" %% "circe-parser" % circeVersion,
      "io.circe" %% "circe-derivation" % "0.9.0-M1",
      "io.circe" %% "circe-generic-extras" % "0.9.1",
      "org.scalatest" %% "scalatest" % scalaTestVersion % Test
    )
  )

lazy val client = (project in file("client"))
  .settings(commonSettings)
  .settings(
    crossScalaVersions := Seq("2.11.11", "2.12.4"),
    name := "client",
    moduleName := "client",
    libraryDependencies += "net.databinder.dispatch" %% "dispatch-core" % "0.12.0"  exclude("org.scala-lang.modules", "scala-xml")
    }.value,
   (compile in Compile) := (compile in Compile).dependsOn(scapegoat).value
  ).dependsOn(protocol)

lazy val root = (project in file("."))
  .settings(commonSettings)
  .settings(
    name := "service",
    moduleName := "service"
  ).aggregate(protocol, client)

running just sbt assembly with no crossbuild works fine.
Also removing (compile in Compile) := (compile in Compile).dependsOn(scapegoat).value does not affect the cross build - it still fails, only removing the plugin from plugins.sbt makes it work.

Will appreciate any feedback, thanks

Bug - reporting on a missing file

Tool is awesome btw!
On the ensime-server source scapegoat is reporting an error at <no file>:0

Warning Expression as statement com.sksamuel.scapegoat.inspections.unneccesary.ExpressionAsStatement
Expression as statement at <empty>

Configuration/Suppressions from an file

We have 8 different multi-module projects, each with 5 or more projects in each. We would like to be able to have a Configuration/Suppressions file that can be used instead of having to modify each project. This way we can enforce the same rules and reduce the chance of mistakes. A good example of this would be scalaStyle and the scalastyle-config.xml file. Each multi-module projects uses its own scalastyle-config.xml which is copied from the master version under source control.

If we can get a scapegoat-config.xml file that would be very helpful for us that have complex build environments.

java.lang.IncompatibleClassChangeError in version 1.0.9

Hi. I have multi-module sbt project with single module.

My environment:

  • sbt.version = 1.1.1
  • scalaVersion in ThisBuild := "2.12.3"
  • Oracle Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
  • Ubuntu 16.04 x64
  • addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.9")
  • scapegoatVersion in ThisBuild := "1.3.4"

Running commands sbt scapegoat or sbt "project module1" scapegoat results in error:

[error] java.lang.IncompatibleClassChangeError: vtable stub
[error]         at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:488)
[error]         at java.lang.StringBuilder.append(StringBuilder.java:166)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.$anonfun$inspect$1(DuplicateImport.scala:28)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.$anonfun$inspect$1$adapted(DuplicateImport.scala:27)
[error]         at scala.collection.immutable.List.foreach(List.scala:389)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.inspect(DuplicateImport.scala:27)
[error]         at com.sksamuel.scapegoat.InspectionContext$Traverser.traverse(Inspection.scala:94)
[error]         at com.sksamuel.scapegoat.InspectionContext$Traverser.traverse$(Inspection.scala:82)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.traverse(DuplicateImport.scala:14)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.traverse(DuplicateImport.scala:14)
[error]         at scala.reflect.api.Trees$Traverser.$anonfun$traverseStats$2(Trees.scala:2498)
[error]         at scala.reflect.api.Trees$Traverser.atOwner(Trees.scala:2507)
[error]         at scala.reflect.api.Trees$Traverser.$anonfun$traverseStats$1(Trees.scala:2498)
[error]         at scala.reflect.api.Trees$Traverser.traverseStats(Trees.scala:2497)
[error]         at scala.reflect.internal.Trees.itraverse(Trees.scala:1337)
[error]         at scala.reflect.internal.Trees.itraverse$(Trees.scala:1211)
[error]         at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)
[error]         at scala.reflect.internal.SymbolTable.itraverse(SymbolTable.scala:16)
[error]         at scala.reflect.api.Trees$Traverser.traverse(Trees.scala:2475)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.com$sksamuel$scapegoat$InspectionContext$Traverser$$super$traverse(DuplicateImport.scala:14)
[error]         at com.sksamuel.scapegoat.InspectionContext$Traverser.continue(Inspection.scala:78)
[error]         at com.sksamuel.scapegoat.InspectionContext$Traverser.continue$(Inspection.scala:78)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.continue(DuplicateImport.scala:14)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.inspect(DuplicateImport.scala:21)
[error]         at com.sksamuel.scapegoat.InspectionContext$Traverser.traverse(Inspection.scala:94)
[error]         at com.sksamuel.scapegoat.InspectionContext$Traverser.traverse$(Inspection.scala:82)
[error]         at com.sksamuel.scapegoat.inspections.imports.DuplicateImport$$anon$2$$anon$1.traverse(DuplicateImport.scala:14)
[error]         at com.sksamuel.scapegoat.ScapegoatComponent$Transformer.$anonfun$transform$3(plugin.scala:203)
[error]         at com.sksamuel.scapegoat.ScapegoatComponent$Transformer.$anonfun$transform$3$adapted(plugin.scala:202)
[error]         at scala.Option.foreach(Option.scala:257)
[error]         at com.sksamuel.scapegoat.ScapegoatComponent$Transformer.$anonfun$transform$2(plugin.scala:202)
[error]         at com.sksamuel.scapegoat.ScapegoatComponent$Transformer.$anonfun$transform$2$adapted(plugin.scala:200)
[error]         at scala.collection.immutable.List.foreach(List.scala:389)
[error]         at com.sksamuel.scapegoat.ScapegoatComponent$Transformer.transform(plugin.scala:200)
[error]         at com.sksamuel.scapegoat.ScapegoatComponent$Transformer.transform(plugin.scala:189)
[error]         at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:140)
[error]         at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:30)
[error]         at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:426)
[error]         at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:419)
[error]         at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1(Global.scala:390)
[error]         at scala.tools.nsc.Global$GlobalPhase.$anonfun$run$1$adapted(Global.scala:390)
[error]         at scala.collection.Iterator.foreach(Iterator.scala:929)
[error]         at scala.collection.Iterator.foreach$(Iterator.scala:929)
[error]         at scala.collection.AbstractIterator.foreach(Iterator.scala:1417)
[error]         at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:390)
[error]         at com.sksamuel.scapegoat.ScapegoatComponent$$anon$1.run(plugin.scala:155)
[error]         at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1431)
[error]         at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1416)
[error]         at scala.tools.nsc.Global$Run.compileSources(Global.scala:1412)
[error]         at scala.tools.nsc.Global$Run.compile(Global.scala:1515)
[error]         at xsbt.CachedCompiler0.run(CompilerInterface.scala:130)
[error]         at xsbt.CachedCompiler0.run(CompilerInterface.scala:105)
[error]         at xsbt.CompilerInterface.run(CompilerInterface.scala:31)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.lang.reflect.Method.invoke(Method.java:498)
[error]         at sbt.internal.inc.AnalyzingCompiler.call(AnalyzingCompiler.scala:237)
[error]         at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:111)
[error]         at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:90)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$3(MixedAnalyzingCompiler.scala:83)
[error]         at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:134)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:74)
[error]         at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:117)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:305)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:305)
[error]         at sbt.internal.inc.Incremental$.doCompile(Incremental.scala:101)
[error]         at sbt.internal.inc.Incremental$.$anonfun$compile$4(Incremental.scala:82)
[error]         at sbt.internal.inc.IncrementalCommon.recompileClasses(IncrementalCommon.scala:110)
[error]         at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:57)
[error]         at sbt.internal.inc.Incremental$.$anonfun$compile$3(Incremental.scala:84)
[error]         at sbt.internal.inc.Incremental$.manageClassfiles(Incremental.scala:129)
[error]         at sbt.internal.inc.Incremental$.compile(Incremental.scala:75)
[error]         at sbt.internal.inc.IncrementalCompile$.apply(Compile.scala:61)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:309)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:267)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:158)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:237)
[error]         at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:68)
[error]         at sbt.Defaults$.compileIncrementalTaskImpl(Defaults.scala:1429)
[error]         at sbt.Defaults$.$anonfun$compileIncrementalTask$1(Defaults.scala:1403)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error]         at sbt.std.Transform$$anon$4.work(System.scala:66)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error]         at sbt.Execute.work(Execute.scala:271)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error]         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error]         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error]         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error]         at java.lang.Thread.run(Thread.java:748)

Plugin dependency isn't resolved

Can't add plugin even to a dummy project.

Project as a gist is here: https://gist.github.com/daron666/a34cea78c9a20f8f6243e6c635f0362b

screen shot 2018-02-02 at 09 25 55

I'm using Idea as a IDE, but even from command line I wasn't able to run scapegoat task and got this error

sbt:scapegoat-not-working> scapegoat
[info] [scapegoat] Removing scapegoat class directory: /Users/daron/IdeaProjects/scapegoat-not-working/target/scala-2.12/scapegoat-classes
[error] java.lang.Exception: Fatal: scalac-scapegoat-plugin not in libraryDependencies (Vector(/Users/daron/.sbt/boot/scala-2.12.4/lib/scala-library.jar))
[error] 	at com.sksamuel.scapegoat.sbt.ScapegoatSbtPlugin$.$anonfun$projectSettings$4(ScapegoatSbtPlugin.scala:67)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:39)
[error] 	at sbt.std.Transform$$anon$4.work(System.scala:66)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:262)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.Execute.work(Execute.scala:271)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:262)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:174)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:36)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (Scapegoat / scalacOptions) java.lang.Exception: Fatal: scalac-scapegoat-plugin not in libraryDependencies (Vector(/Users/daron/.sbt/boot/scala-2.12.4/lib/scala-library.jar))
[error] Total time: 0 s, completed Feb 2, 2018 9:30:14 AM

What am I doing wrong?

Issues with enabling sbt-scapegoat plugin in a project that does not uses build.sbt

Hi everyone,

I have a project which does not have a build.sbt, instead there is a BuildSettings.scala file.
I am trying to enable the scapegoat plugin in there and facing issues while doing so.
Here is what I have done so far :

I added the addSbtPlugin("com.sksamuel.scapegoat" %% "sbt-scapegoat" % "1.0.4") to project/plugins.sbt file. Then tried building the project. it built successfully but when I try running scapegoat it gives following error

[error] Not a valid command: scapegoat (similar: set)
[error] Not a valid project ID: scapegoat
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: scapegoat (similar: aggregate)
[error] scapegoat
[error]          ^

Then I tried adding the scapegoatVersion to BuildSettings.scala file and that gave me compile time error

project\BuildSettings.scala:29: not found: value scapegoatVersion
[error]     scapegoatVersion      :=  "1.0.4",
[error]     ^
[error] one error found
[error] (compile:compile) Compilation failed

Then I added scapegoat as import to the BuildSettings.scala file, thinking that was missing. The error changes again

[error] bad symbolic reference. A signature in ScapegoatSbtPlugin.class refers to type AutoPlugin
[error] in package sbt which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling ScapegoatSbtPlugin.class.
[error] project\BuildSettings.scala:29: not found: value scapegoatVersion
[error]     scapegoatVersion      :=  "1.0.4",
[error]     ^
[error] two errors found
[error] (compile:compile) Compilation failed

What might I be missing here. Please suggest some way/steps to enable this plugin properly for my project.

Thanks
Nishant

Make scapegoat config options optional

Problem

If you don't specify scapegoatDisabledInspections, sbt compile fails:

[info] Loading global plugins from /home/tom/.sbt/0.13/plugins
[info] Loading project definition from /src/foo-service/project
[info] Set current project to foo-service-public (in build file:/src/foo-service/)
[info] [scapegoat] setting output dir to [/src/foo-service/target/scala-2.11/scapegoat-report]
[info] [scapegoat] disabled inspections: ExpressionAsStatement,VarUse
[info] Compiling 36 Scala sources to /src/foo-service/target/scala-2.11/classes...
[error] bad option: '-P:scapegoat:enabledInspections:'
[error] (compile:compile) Compilation failed
[error] Total time: 1 s, completed 30-Oct-2014 16:03:46

Workaround

Set scapegoatDisabledInspections to a non-empty set, e.g. scapegoatDisabledInspections := Seq("WildcardImport")

Preferred solution

scapegoatDisabledInspections be optional

Versions

sbt-scapegoat version: 0.94.5
sbt version: 0.13.5
scalac version: 2.11.4

Bring back Max{Info,Warning,Error}s

It seems that they were removed some long ago (in ceea0b0) but their options persisted.

Either add them back - which is the desired behavior, to fail a build based on too much error/warnings - or remove the option, which is misleading.

Option for output in sbt console instead of xml reports

While the XML/HTML reports are pretty, they are impractical to use for iterative development, especially in a project that contains many sub-projects as you have to manually navigate to each file and view it. There should be an option to output the warnings/errors directly into the sbt console while the checks are running.

Overly agressive error/warning for Unnecessary return

In ensime-server Completion.scala:205/211

Error Unnecessary return com.sksamuel.scapegoat.inspections.unneccesary.UnnecessaryReturnUse
Scala returns the value of the last expression in a function. Use of return is not needed here

They are not unnecessary right now - removing them would change the meaning of the function.

I think this is really a warning rather than an error.

Enable scapegoatMaxErrors

It seems the functionality for scapegoatMaxErrors (and the equivalent for warnings and infos) were disabled in commit ceea0b0. Apparently due to some bug.

Could this functionality be re-enabled?

Where are the releases hosted?

Can't find com.sksamuel.scapegoat:scalac-scapegoat:0.94.5 (scalaVersion=2.11, sbtVersion=0.13). I've also checked the SBT release repo and Maven central, and it doesn't exist in either.

scalacOptions doesn't work

Putting scalacOptions += "-P:scapegoat:overrideLevels:TraversableHead=Warning:OptionGet=Warning" in build.sbt produces following error on sbt compile:

[error] bad option: -P:scapegoat:overrideLevels:TraversableHead=Warning:OptionGet=Warning
[error] one error found
[error] (compile:compileIncremental) Compilation failed

Create sbt task for scapegoat

Currently configuring an sbt project to use scapegoat has the effect that scapegoat will run during the compile phase, as configured, every time.

Please create an sbt task that will allow scapegoat to run on demand, and decouple from running during the default compilation phase, as is the case with scalastyle. This will allow users to optionally run scapegoat periodically, and otherwise run the build without penalizing compile times.

Readme has wrong (broken version)

Just tried 0.90.12 (based on readme) and got an exception. Was about to raise a ticket for that and realise 0.90.13 was there - tried that on the offchance and it worked.

So this request is just to update the readme with the correct version (and the changelog...)

Is there any Maven support?

I have integrated maven dependency and maven plugin in pom.xml

com.sksamuel.scapegoat scalac-scapegoat-plugin_2.11 0.94.5

${basedir}/src/main/scala ${basedir}/src/test/scala net.alchim31.maven scala-maven-plugin ${maven.plugin.scala.version} ${scala.major.version} ${scala.version} com.sksamuel.scapegoat scalac-scapegoat-plugin_${scala.major.version} ${scalac.plugin.scapegoat.version} com.sksamuel.scapegoat scalac-scapegoat-plugin_${scala.major.version} ${scalac.plugin.scapegoat.version} -P:scapegoat:dataDir:target -P:scapegoat:consoleOutput:true compile testCompile

Is there any support for maven

or any command to build and generate report.

Please help me on this.

Thanks
Zeeshan

Scapegoat not running in test only projects

I have a project that has no source under src/main. All source is under src/test.

Running sbt clean test:compile I get the following output:
jonathon:~/devroot/BehaviourTests$ sbt clean test:compile
[info] Loading project definition from /home/jonathon/devroot/BehaviourTests/project
[info] Set current project to BehaviourTests (in build file:/home/jonathon/devroot/BehaviourTests/)
[success] Total time: 0 s, completed 25-Mar-2015 10:12:42 AM
[info] Updating {file:/home/jonathon/devroot/BehaviourTests/}behaviourtests...
[info] Resolving jline#jline;2.12 ...
[info] Done updating.
[info] [scapegoat] setting output dir to [/home/jonathon/devroot/BehaviourTests/target/scala-2.11/scapegoat-report]
[info] Compiling 147 Scala sources to /home/jonathon/devroot/BehaviourTests/target/scala-2.11/test-classes...
[success] Total time: 13 s, completed 25-Mar-2015 10:12:55 AM

The scapegoat-report directory is not created.

I'm using sbt launcher version 0.13.7
My build definition uses Scala 2.11.5

Idiomatic way to run scapegoat on compile

What's the idiomatic way to run scapegoat automatically on compile? ie. I want sbt compile to run scapegoat.

I tried adding this in my build.sbt:

compile in Compile := (compile in Compile).dependsOn(scapegoat).value

This works, however, it compiles all classes twice - once in target/scala-2.11/scapegoat-classes and once in target/scala-2.11/classes. Is there a better way?

publish to central

same story as scoverage

[error] (*:update) sbt.ResolveException: unresolved dependency: com.sksamuel.scapegoat#scalac-scapegoat-plugin_2.10;1.0.0: not found

Cross version blocker

While trying to upgrade to SBT 1.0.3, is seems that the dependency to scala-xml added by sbt-scapegoat is breaking the cross compilation:

[error]    org.scala-lang.modules:scala-xml _2.12, _2.11
[error] java.lang.RuntimeException: Conflicting cross-version suffixes in: org.scala-lang.modules:scala-xml
[error] 	at scala.sys.package$.error(package.scala:27)
[error] 	at sbt.librarymanagement.ConflictWarning$.processCrossVersioned(ConflictWarning.scala:39)
[error] 	at sbt.librarymanagement.ConflictWarning$.apply(ConflictWarning.scala:19)
[error] 	at sbt.Classpaths$.$anonfun$ivyBaseSettings$64(Defaults.scala:1971)
[error] 	at sbt.Classpaths$$$Lambda$1109/1112560756.apply(Unknown Source)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] 	at scala.Function1$$Lambda$997/1585776625.apply(Unknown Source)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
[error] 	at sbt.internal.util.$tilde$greater$$Lambda$1828/1422262786.apply(Unknown Source)
[error] 	at sbt.std.Transform$$anon$4.work(System.scala:64)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error] 	at sbt.Execute$$Lambda$1845/2116248721.apply(Unknown Source)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] 	at sbt.Execute.work(Execute.scala:266)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error] 	at sbt.Execute$$Lambda$1836/127758389.apply(Unknown Source)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error] 	at sbt.ConcurrentRestrictions$$anon$4$$Lambda$1843/1340928776.apply(Unknown Source)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
[error] 	at java.lang.Thread.run(Thread.java:745)
sbt> dependencyTree

[info] Done updating.
[info] ...
[info]   +-com.sksamuel.scapegoat:scalac-scapegoat-plugin_2.12:1.3.3 [S]
[info]     +-org.scala-lang.modules:scala-xml_2.12:1.0.5 [S]
[info]     +-org.scala-lang:scala-reflect:2.11.11 [S]

Path invalid in Windows for scapegoat-scalastyle.xml

scapegoat-scalastyle.txt
In the report, all slashes are replaced by dots. So I can not get the reference of the file in my continuous integration server

Example :
C:.Program Files.Jenkins.jobs.backofficeapi.RouteService.scala
instead of
C:\Program Files\Jenkins.jobs\backofficeapi\RouteService.scala

Can you fix this please ?

Thank you

Not seeing much in HTML report - lots of things on console (Feature Request?)

When I run the scapegoat task (1.2.1) I see lots of useful output on the console but the HTML report has only one info item in it.

This is a multi-project build, so is it possible my reports are getting overwritten and the "empty" report is for the root project, which has no code in it?

If so, then a feature request would be to be able to generate multiple HTML reports, one per sub-project.

Task doesn't return an error status when there are warnings/errors

I'm using the scapegoat sbt plugin and it's finding problems with the codebase, which is awesome. I'd like to fix them and integrate it with the CI environment to prevent future failures. Unfortunately, it looks like the scapegoat task always returns a 0 status code, even if there are warnings/errors. This makes integrating it with a CI environment more difficult.

How do I make `sbt scapegoat` not run `scapegoatClean`?

Currently when I run sbt scapegoat it recompiles and reanalyzes my entire project. I want it to only analyze what was already going to be recompiled. I added scapegoatRunAlways := false to my build.sbt because it's documented as doing exactly what I want. It had no effect, and looking at the source for this project I see that it only affects the behavior of scapegoatCleanTask, which can only be invoked manually.

I found this in the source:

  (compile in Scapegoat) <<= (compile in Scapegoat) dependsOn scapegoatClean,
  scapegoat := (compile in Scapegoat).value,

Since scapegoat depends on scapegoatClean, what I want seems to be impossible. The top line were changed to use scapegoatCleanTask (which respects scapegoatRunAlways) instead of scapegoatClean, all would be well.

  (compile in Scapegoat) <<= (compile in Scapegoat) dependsOn scapegoatCleanTask,

scapegoat failOnError := false

Hi,
Is there any way to do NOT fail if an error is found while scapegoat task is executed?
Since I have to upload the scapegoat-report to sonar, wouldn't be better to have this option?
Do you have some example in order to go ahead even if errors are found?
Thanks in advance.

Does not add provided dependencies to classpath

If a project contains some dependencies that are provided rather than in compile or test scope then they are not added to the scapegoat:managedClasspath resulting in compile failures.

project/Dependencies.scala (snippet)

// Scalactic utilities
  val scalactic = "org.scalactic" %% "scalactic" % scalatestVersion % "provided"

  val jodaTime = "joda-time" % "joda-time" % jodaTimeVersion
  val jodaConvert = "org.joda" % "joda-convert" % jodaConvertVersion

Output of show scapegoat:managedClasspath

[info] utils/scapegoat:managedClasspath
[info]  List(Attributed(/home/tim/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.7.jar), Attributed(/home/tim/.ivy2/cache/com.sksamuel.scapegoat/scalac-scapegoat-plugin_2.11/jars/scalac-scapegoat-plugin_2.11-1.0.0.jar), Attributed(/home/tim/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.6.jar), Attributed(/home/tim/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.2.jar), Attributed(/home/tim/.ivy2/cache/org.scaldi/scaldi_2.11/jars/scaldi_2.11-0.4.jar), Attributed(/home/tim/.ivy2/cache/joda-time/joda-time/jars/joda-time-2.8.1.jar), Attributed(/home/tim/.ivy2/cache/org.joda/joda-convert/jars/joda-convert-1.7.jar), Attributed(/home/tim/.ivy2/cache/org.clapper/grizzled-slf4j_2.11/jars/grizzled-slf4j_2.11-1.0.2.jar), Attributed(/home/tim/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.7.7.jar), Attributed(/home/tim/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.1.3.jar), Attributed(/home/tim/.ivy2/cache/ch.qos.logback/logback-core/jars/logback-core-1.1.3.jar), Attributed(/home/tim/.ivy2/cache/org.codehaus.groovy/groovy/jars/groovy-2.4.3.jar))
[info] root/scapegoat:managedClasspath
[info]  List(Attributed(/home/tim/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.7.jar), Attributed(/home/tim/.ivy2/cache/com.sksamuel.scapegoat/scalac-scapegoat-plugin_2.11/jars/scalac-scapegoat-plugin_2.11-1.0.0.jar), Attributed(/home/tim/.ivy2/cache/org.scala-lang/scala-reflect/jars/scala-reflect-2.11.6.jar), Attributed(/home/tim/.ivy2/cache/org.scala-lang.modules/scala-xml_2.11/bundles/scala-xml_2.11-1.0.2.jar), Attributed(/home/tim/.ivy2/cache/org.scaldi/scaldi_2.11/jars/scaldi_2.11-0.4.jar))

Adding the (provided) dependency to the Scapegoat libraryDependencies also doe snot work:

libraryDependencies in Scapegoat ++= Seq(scalactic)

while(true) double reports

while(true) { ... }

reports both

Warning While true loop com.sksamuel.scapegoat.inspections.controlflow.WhileTrue
which is absolutely valid
but whilst also true this warning is then unneeded:
Warning Constant if expression com.sksamuel.scapegoat.inspections.unneccesary.ConstantIf

Inspection warning level overrides with multi-project

Hi,

I am trying to use scapegoat with multi-project.

I am not able to downgrade inspection warning level (from error to warning).

I add this in Common.scala which is called with .settings(Common.settings) for each subproject.

lazy val settings = Seq(
    scalaVersion := "2.11.12",
    //Scapegoat setting
    scapegoatVersion in ThisBuild := "1.3.5",
    scapegoatDisabledInspections := Seq("FinalModifierOnCaseClass"),
    scalacOptions ++= Seq("-P:scapegoat:overrideLevels:TryGet=Warning:EmptyInterpolatedString=Warning")
  )

But I have bad option: -P:scapegoat:overrideLevels:TryGet=Warning:EmptyInterpolatedString=Warning.

Is there a problem ?

EDIT:
I also tried sbt scapegoat -P:scapegoat:overrideLevels:TryGet=Warning directly in terminal, it seems that scapegoat doesn't take it into account.

Can't use plugin with sbt 1.0

Not sure what I do wrong but plugin is not available neither with version 1.0.0 nor with 1.0.1

[warn] 	Note: Some unresolved dependencies have extra attributes.  Check that these dependencies exist with the requested attributes.
[warn] 		com.sksamuel.scapegoat:sbt-scapegoat:1.0.4 (scalaVersion=2.12, sbtVersion=1.0)
[warn] 
[warn] 	Note: Unresolved dependencies path:
[warn] 		com.sksamuel.scapegoat:sbt-scapegoat:1.0.4 (scalaVersion=2.12, sbtVersion=1.0) (/home/expert/work/sideprojects/akka-http-throttling/project/plugins.sbt#L5-6)
[warn] 		  +- default:akka-http-throttling-build:0.1-SNAPSHOT (scalaVersion=2.12, sbtVersion=1.0)

What am I missing ?

Scapegoat forces a clean

The scapegoat task has a hard dependency on clean, this empties the target folder and doesn't play nicely together with other tools like scoverage, because it not only removes its own reports but the entire target folder if you run something like sbt scoverage scapegoat.

https://github.com/sksamuel/sbt-scapegoat/blob/master/src/main/scala/com/sksamuel/scapegoat/sbt/ScapegoatSbtPlugin.scala#L79

What is the reasoning behind this? Wouldn't it be possible to only remove the scapegoatOutputPath?

Match instead of partial function

When I am using the map on future and then when getting result according to my case. Scapegoat throwing me an info Match instead of partial function.

Val futureResult = Future("Data") futureResponse map { case "Data" => case _ => //handle exception case }
Help me in resolving this.

Scapegoat doesn't like Play

Hi,
I'm trying to integrate scapegoat with Play 2.3.4 and it turns out that there're some issues with Play's code generation feature. First of all, scapgegoat is desperately trying to go through compiled templates, spitting out enormous number of issues - this however can be with a rule like scapegoatIgnoredFiles := Seq(".*assets.*", ".*src_managed.*"). The bigger problem is that it fails (2 out of 3 times) during code generation with some cryptic error messages like:
source file '...target/scala-2.11/src_managed/main/assets/controllers/routes.java' could not be found or similar. Any ideas? Thanks!
Łukasz

Error when enabling plugin

Hi,

I tried adding scapegoat to the ensime build, adding the plugin line to the project/plugins.sbt as described in the readme.

When I attempt a compile I get an error:

$ sbt compile
[info] Loading project definition from /home/rory/workspace/ensime-src/project
[info] Set current project to ensime (in build file:/home/rory/workspace/ensime-src/)
java.lang.Exception: Fatal: scalac-scapegoat-plugin not in libraryDependencies
        at com.sksamuel.scapegoat.sbt.ScapegoatSbtPlugin$$anonfun$projectSettings$3.apply(ScapegoatSbtPlugin.scala:33)
        at com.sksamuel.scapegoat.sbt.ScapegoatSbtPlugin$$anonfun$projectSettings$3.apply(ScapegoatSbtPlugin.scala:28)
...
       at java.lang.Thread.run(Thread.java:745)
[error] (compile:compile::scalacOptions) java.lang.Exception: Fatal: scalac-scapegoat-plugin not in libraryDependencies
[error] Total time: 0 s, completed 08-Aug-2014 19:15:02

This on this project https://github.com/ensime/ensime-server in case something we are doing has an impact.
Am I missing something obvious?

Cheers

Rory

Logging too verbose

When scapegoat is running it outputs an "info" line for every class that it checks which really clutters up the output. Would it also be possible to turn off the "settings" output as well (maybe turn them into debugs)? This could be optional via another setting. I think the "analysis complete" line is okay always being output.

Class output:

[info] Scapegoat analysis [Converters.scala] .....
[info] Scapegoat analysis [InetCleaner.scala] .....
[info] Scapegoat analysis [Ping.scala] .....
[info] Scapegoat analysis [Printer.scala] .....
[info] Scapegoat analysis [IP.scala] .....
[info] Scapegoat analysis [Converters.scala] .....
[info] Scapegoat analysis [ISO.scala] .....
[info] Scapegoat analysis [Short.scala] .....

Settings output:

[info] [scapegoat] setting output dir to [/{snip}/scapegoat-report]
[info] [scapegoat] disabled inspections: VarUse,WildcardImport,PointlessTypeBounds
[info] [scapegoat] setting output dir to [/{snip}/scapegoat-report]
[info] [scapegoat] disabled inspections: VarUse,WildcardImport,PointlessTypeBounds
...
[info] [scapegoat] 101 activated inspections
[info] [scapegoat] List() ignored file patterns
...
[info] [scapegoat] Written HTML report [/{snip}/scapegoat.html]
[info] [scapegoat] Written XML report [/{snip}/scapegoat.xml]

Reporting unused parameters on overridden methods

  private val pendingBreaksBySourceName = new mutable.HashMap[String, mutable.HashSet[Breakpoint]] {
    override def default(key: String) = new mutable.HashSet()
  }

Gives

Warning Unused method parameter com.sksamuel.scapegoat.inspections.unneccesary.UnusedMethodParameter
Unused method parameter (val key: String = _) at default

This overrides an interface forcing the param (In this case I don't need it, so I think if this is an override method it probably shouldn't report.

Also why does it say = ... and at default I think these are just adding noise.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.