Chapter 6Scala Style/Lint

Code smell is often defined “as certain structures in code that indicate violation of fundamental design principles and negatively impact design quality.” Code smells are not bugs, but instead are indications that the structure of code hasn't been fully fleshed out, or was rushed to accommodate features at the cost of code quality. These are indications of a weakness in design and must be handled with a good eye, equally good coding habits, and help from strong style/lint tooling.

This translates to testing your Scala application, meeting its functional and business requirements, and also working to ensure that your code has no structural problems. Luckily, the open source world has created some extremely well programmed and maintained styling/lint tooling for Scala. You can use them to increase the reliability and efficiency of your applications/services, in effect allowing your code over its life cycle to become easier to maintain, understand, and extend.

This chapter takes you through the setting up of the most popular tools for styling and linting. It will also show you how to automate linting, and give your code the best possible chance to stay within current coding conventions.

SCALA WITH STYLE

The first tool to integrate into this book's sample project is a little plugin called scalastyle (http://www.scalastyle.org/). Scalastyle “examines ...

Get Professional Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.