scalastyle / scalastyle-sbt-plugin

scalastyle-sbt-plugin
Apache License 2.0
139 stars 52 forks source link

Trailing commas lead to very confusing scalastyle errors #72

Open steinybot opened 6 years ago

steinybot commented 6 years ago

Trailing commas lead to very confusing errors. Trailing commas were added in SIP-27 (Scala 2.12.2). I don't actually use them intentionally but it can take a very long time to find it since scalac passes but scalastyle fails without any line information and usually on an unrelated token.

For example:

[error] MySpec.scala: illegal start of simple expression: Token(RPAREN,),295,))
import org.scalatest.FlatSpec
import org.scalatest.prop.GeneratorDrivenPropertyChecks

class MySpec extends FlatSpec with GeneratorDrivenPropertyChecks {

  case class Foo(a: String, b: Int)

  Foo(
    "hello",
    123,
  )
}
jtjeferreira commented 5 years ago

Relevant ticket is https://github.com/scalastyle/scalastyle/issues/276

BardurArantsson commented 5 years ago

This comment may be of interest https://github.com/scalastyle/scalastyle/issues/327#issuecomment-531173988