Gradle plugin for scalafmt
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Scalafmt Gradle plugin

Build Status Download

This plugin will allow you to format your scala code as a part of your build process. In the background, it uses scalafmt library.

You can use scalafmt plugin without any configuration. Then defaults from scalafmt will be used. You can adjust these settings by putting .scalafmt.conf to the root of your project. For the supported format and properties see the scalafmt page


buildscript {
	repositories {
	dependencies {
		classpath 'cz.alenkacz:gradle-scalafmt:$putCurrentVersionHere'

apply plugin: 'scalafmt'

scalafmt {
    // configFilePath = ".scalafmt.conf" // .scalafmt.conf in the project root is default value, provide only if other location is needed


Tasks added to your project when applying this plugin:

  • scalafmt - formats your scala and sbt source code (main sourceset only)
  • checkScalafmt - checks whether all files are correctly formatted, if not, the task fails (main sourceset only)
  • testScalafmt - formats your test scala code based on the provided configuration
  • checkTestScalafmt - checks whether your test scala code is correctly formatted
  • scalafmtAll - formats scala code from all source sets
  • checkScalafmtAll - checks formatting of all source sets