How to use scct and Scala Style in Scala-Sbt project

In this blog, I’ll explain the use of scct and scalastyle in your Scala-Sbt project.

scct is Scala code coverage tool. It tests the code coverage using test cases. It measures that how much code is covered by test cases and then it creates test coverage report (index.html) which resides at following position :


For good programming, code coverage should be greater that 90 %.

Add this line in build.sbt file :

seq(ScctPlugin.instrumentSettings : _*)

Add this line in target/plugins.sbt file :

addSbtPlugin("com.github.scct" %% "sbt-scct" % "0.2.1")

To run scct, follow this command :

sbt scct:test

Scalastyle is used to examine your Scala code. When we run scalastyle then it gives warnings for the code which does not follow scala style guidelines.

Add this line in build.sbt file :


Add this line in target/plugins.sbt file:

addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "0.3.2")

To run scala style, follow this command :

sbt scalastyle

For good Scala code, warning should be zero. Sometimes we get the condition, where we have to break scala style guideline, but that is in very rare case. In general, waring should be zero.

About Rishi Khandelwal

Lead Consultant having more than 6 years industry experience. He has working experience in various technologies such as Scala, Java8, Play, Akka, Lagom, Spark, Hive, Kafka, Cassandra, Akka-http, Akka-Streams, ElasticSearch, Backbone.js, html5, javascript, Less, Amazon EC2, WebRTC, SBT
This entry was posted in Scala. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s