scalastyle
scalastyle copied to clipboard
Parsing sources with trailing commas (supported since Scala 2.12.2+)
Scala 2.12.2+ added support for trailing commas. However scalastyle currently doesn't parse source files correctly when trailing commas are used. An error similarly to "Expected identifier, but got Token(RPAREN,),xxx,))" is thrown.
As a very simple example:
package foo.bar
object TrailingCommaTest {
def trailingCommaTest(
foo: String,
bar: Boolean,
) = {}
}
It looks like a scalariform issue.. The exception you receive is thrown by scalariform parser.. It would be great if you file an issue here.
It is unfortunately true that we are dependent upon scalariform here. We'll need to get them to change it.
I've commented on a Scalariform PR to push for making incremental progress here: if Scalaiform can get to a point where the parser doesn't crash, even if preservation of trailing commas doesn't work during automated reformatting, then that unblocks a fix here in Scalastyle (solving the problem for folks who use only Scalastyle and not Scalariform) and solves a huge usability issue (confusing error messages). See https://github.com/scala-ide/scalariform/pull/262#issuecomment-427599200
Scalariform 0.2.7 has been released (with trailing comma support).
https://github.com/scalastyle/scalastyle/pull/332 does the upgrade
Any news on when this might be fixed/released?
hmm, the contributions graph at https://github.com/matthewfarwell doesn't look promising. silence at https://twitter.com/matthewfarwell also
anyone know Matthew IRL and could ask him if he could anoint additional maintainers?
Is there any update on this? It is quite annoying since the error message does not even show where the violation is - may take a while to find out.
issue on new release is https://github.com/scalastyle/scalastyle/issues/327
@matthewfarwell merged #332 a couple days ago
Looking forward to this fix for a long time. @matthewfarwell can you help release a new version or annoint additional maintainers who can help regarding this?
There seems to be no activity on this thread for 2 weeks already. What are our options?
There seems to be no activity on this thread for 2 weeks already. What are our options?
Fork ? I have no answer for 1 year on https://github.com/scalastyle/scalastyle/pull/290
I've asked for a new release many times now e.g. here and here, but unfortunately had no luck. @matthewfarwell @ScrapCodes @y-yoshinoya are you guys still maintaining this repo? If you need any help, I'm sure there are many people in the community who would be willing to help out and maintain this project.
Any one has a workaround for this in gradle? Can we override the scalariform dependency version in the scalastyle gradle plugin?
Maybe it's time to just fork under a new domain name, even if it's just for a single release?
This is still an active issue for my team.
This comment may be of interest: https://github.com/scalastyle/scalastyle/issues/327#issuecomment-531173988