Forrest logo
back to the scalafmt tool

scalafmt:tldr:24d0d

scalafmt: Check if files are correctly formatted, returning `0` if all files respect the formatting style.
$ scalafmt --config ${path-to--scalafmt-conf} --test
try on your machine

This command is used to test the formatting of Scala code using the scalafmt tool with a specific configuration file.

Here is a breakdown of the command:

  • scalafmt is the executable command for running the scalafmt tool.
  • --config is a flag used to specify the configuration file for scalafmt. ${path-to--scalafmt-conf} is a placeholder indicating that you need to provide the actual path to the specific scalafmt configuration file you want to use.
  • --test is a flag used to tell scalafmt to test the formatting of the code based on the provided configuration file.

By running this command, scalafmt will analyze the Scala code in your project according to the rules defined in the configuration file, and it will output any discrepancies between the code's current formatting and the desired formatting specified in the configuration file. This helps ensure consistent and standardized code formatting within your Scala project.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the scalafmt tool