Scalastyle examines your Scala code and indicates potential problems with it. If you have come across Checkstyle for Java, then you’ll have a good idea what scalastyle is. Except that it’s for Scala obviously.
Scalastyle is used as part of the grading framework for the course Functional Programming Principles in Scala by Martin Odersky on Coursera.
How do I use scalastyle?
The latest stable version of Scalastyle is 1.5.1 for Scala 2.11/2.12/2.13. For more details, see the release notes for Scalastyle and sbt-scalastyle.
There are several ways of using it:
- SBT plugin
- Command line
- IntelliJ - you can enable scalastyle in IntelliJ by selecting Settings->Editor->Inspections, then searching for Scalastyle inspections
- sonar-scala - Scala plugin for SonarQube with built in support for Scalastyle
- Codacy - you get out-of-the-box analysis on your git repositories
- Git pre-commit hook
And you’ll need a configuration file. If you have your own custom rules, then see custom rules.
For the list of possible rules, see Implemented Rules.
Download
To download Scalastyle, the jar is available from Sonatype:
2.13,
2.12,
2.11.
For the SBT plugin, see Scalastyle SBT Plugin.
The latest development snapshots are available from
Sonatype snapshots.
Rules
For a list of current rules, see Implemented Rules.
If you want to add a rule, then please raise an Issue (or even better a pull request).
For the version 1.5.0 rules, see 1.5.0 Implemented Rules.
For the version 1.4.0 rules, see 1.4.0 Implemented Rules.
For the version 1.3.0 rules, see 1.3.0 Implemented Rules.
For the version 1.2.0 rules, see 1.2.0 Implemented Rules.
For the version 1.1.1 rules, see 1.1.1 Implemented Rules.
For the version 1.1.0 rules, see 1.1.0 Implemented Rules.
For the version 1.0.0 rules, see 1.0.0 Implemented Rules.
For older versions, see scalastyle.org.
Contributing
If you wish to contribute to Scalastyle, please see the Scalastyle Developer Guide.
Questions and comments
If you have any questions or comments, please see Scalastyle users Google group or the Gitter channel.