Skip to content

Commit

Permalink
Merge branch 'master' of github.com:sksamuel/scapegoat
Browse files Browse the repository at this point in the history
  • Loading branch information
mccartney committed Sep 29, 2020
2 parents f8d683e + f0fb308 commit 52c87f4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

version = "2.6.4"
version = "2.7.2"
maxColumn = 110
docstrings = JavaDoc
assumeStandardLibraryStripMargin = true
Expand Down
6 changes: 3 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// compiler plugins
addCompilerPlugin("org.scalameta" % "semanticdb-scalac" % "4.3.20" cross CrossVersion.full)
addCompilerPlugin("org.scalameta" % "semanticdb-scalac" % "4.3.22" cross CrossVersion.full)

name := "scalac-scapegoat-plugin"
organization := "com.sksamuel.scapegoat"
Expand Down Expand Up @@ -105,11 +105,11 @@ libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % "1.3.0" excludeAll (
ExclusionRule(organization = "org.scala-lang")
),
"org.scala-lang.modules" %% "scala-collection-compat" % "2.1.6" excludeAll (
"org.scala-lang.modules" %% "scala-collection-compat" % "2.2.0" excludeAll (
ExclusionRule(organization = "org.scala-lang")
),
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "test",
"org.scalatest" %% "scalatest" % "3.2.0" % "test",
"org.scalatest" %% "scalatest" % "3.2.2" % "test",
"org.mockito" % "mockito-all" % "1.10.19" % "test",
"joda-time" % "joda-time" % "2.10.6" % "test",
"org.joda" % "joda-convert" % "2.2.1" % "test",
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ resolvers += Classpaths.sbtPluginReleases

addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.19")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.21")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")

if (System.getProperty("add-scapegoat-plugin") == "true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class AvoidSizeNotEqualsZero
override def inspect(tree: Tree): Unit = {
tree match {
case Apply(
Select(Select(_, Length | Size), TermName("$bang$eq") | TermName("$greater")),
Select(Select(q, Length | Size), TermName("$bang$eq") | TermName("$greater")),
List(Literal(Constant(0)))
) =>
) if isTraversable(q) =>
context.warn(tree.pos, self, tree.toString.take(100))
case _ => continue(tree)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,17 @@ class AvoidSizeNotEqualsZeroTest extends InspectionTest {
compileCodeSnippet(code)
compiler.scapegoat.feedback.warnings.size shouldBe 10
}
// github issue #414
"should ignore durations" in {
val code = """object Test {
|case class Duration(start: Long, stop: Long) {
| def length: Long = stop - start
| def nonEmpty: Boolean = length > 0
| }
} """.stripMargin

compileCodeSnippet(code)
compiler.scapegoat.feedback.warnings.size shouldBe 0
}
}
}

0 comments on commit 52c87f4

Please sign in to comment.