Wednesday, March 18, 2015

Strict Coding Style SBT project (using giter8)

At this moment ScalaDays is going on in nearby San Francisco. I came across a Toward a Safer Scala talk that emphasized writing safer Scala using strict static code analysis. After watching the talk I put together a giter8 template that implements their recommendations. If you have giter8 installed you can try out the basicscala template using:

g8 hohonuuli/basicscala.g8
Here's some things that this template provides:
  • Formats source files on compile using Scalariform
  • Adds strict scala compiler flags in build.sbt
  • Build fails on compiler warnings
  • Adds Wartremover to Scala's linter. You can run lint and wartremover in sbt using 'lint:compile'.
  • Includes junit and scalatest
  • Includes scala-style for checking code sytle. You will need to run 'sbt scalastyleGenerateConfig' to generate a scalastyle-config file. After which, you can run 'sbt scalastyle' to check your projects.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.