DeepSource now supports Scalafmt

Having a uniform style across your codebase helps maintain its readability and makes navigation easier. Code formatters help with just that, and they exist for almost every primary language – whether official or community-supported. For example, there is clang-format for C and C++, gofmt for Go, and scalafmt for Scala.

Apart from Analyzers, DeepSource also supports Transformers, a feature that formats code on auto-pilot across your repositories — commits and pull requests. In July, we released a beta version of our Scala Analyzer. Today, we have completed the support for the Scala ecosystem. We are happy to announce the support for scalafmt . You can now ensure that not only your code adheres to the required standards but is also styled consistently across the codebase.

Here’s what a Transformers workflow looks like:

  • If a pull/merge request is raised with the default branch as the base, a
    transforming commit is added to that branch.
  • If a commit is created on the default branch, DeepSource raises a pull/merge
    request with transforming changes.

Q: How do I enable the scalafmt Transformer?

Add an entry in transformers table in .deepsource.toml with the name of the transformer and enabled = true .

e.g., to add scalafmt :

[[transformers]]
name = "scalafmt"
enabled = true

If you don’t like to type TOML by hand, go to Settings → “Generate Configuration” and select the ones you’d like to add from the list.

Want to know more about our Scala Analyzer? Head over here and give it a read!

4 Likes