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 :

Add this line in target/plugins.sbt file :

To run scct, follow this command :

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:

To run scala style, follow this command :

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.

Share the Knol:

Related

Rishi is a Lead Consultant, with experience of more than 7 years. Rishi is product focused developer who loves developing both front-end user interfaces and scalable back-end infrastructure. He is a good team player, quick learner and a humble person. He has good time management skills, aimed to give best results and fully dedicated towards his work & responsibilities. He is able to work as individual and as well as in team. He loves to share his knowledge, therefore he often writes technical blogs.

Knoldus is the world’s largest pure-play Scala and Spark company. We modernize enterprise through
cutting-edge digital engineering by leveraging Scala, Functional Java and Spark ecosystem. Our mission is to provide reactive and streaming fast data solutions that are message-driven, elastic, resilient, and responsive.

Knoldus is the world's largest pure-play Scala and Spark company. We modernize enterprise through
cutting-edge digital engineering by leveraging Scala, Functional Java and Spark ecosystem. Our mission is to provide reactive and streaming fast data solutions that are message-driven, elastic, resilient, and responsive.