Scala Clippy : The Helping Hand
Hi all, I am back with another blog. This one is really interesting. As a developer, we usually come across many types of compilation errors some take a hard time to rectify it. This is what we require Scala Clippy. Scala Clippy provides a human-friendly explanation to some of the common errors that we make. Let’s take a simple example,
Now these type of errors is presented like this when we use Scala Clippy:
Now you may be wondering how these errors are identified and we get advice related to it.
Simple, these are provided by the Scala community. If you visit their official website Scala Clippy where you can find a tab “Contribute”. Under that, we can post our own errors. These errors are parsed first, and when successful we can add our advice which will be reviewed and if accepted it will be added to their database which will, in turn, be beneficial to others.
Now next question will be, how to add this in our project.
Add a plugin
The easiest way to use clippy is through sbt plugin.
addSbtPlugin(“com.softwaremill.clippy” % “plugin-sbt” % “0.5.3”)
In first compilation, it will download the advice dataset (i.e advice list) from their official website and store it in $HOME/.clippy which will be automatically updated in the background once in a day.
We are done…….!!
Will this affect the performance?
Not much because this plugin only acts when there’s a compiler error. So adding an overhead to a failure will not affect that much.
I am leaving my GitHub link for the above example for reference.
Thank you for your patience.