![Forrest logo](/images/logo.png)
scalafmt:tldr:5c3ad
The command scalafmt
is used to format Scala code according to a specified configuration.
Here is an explanation of each part of the command:
-
--config ${path-to--scalafmt-conf}
: This flag specifies the path to thescalafmt
configuration file (usually named.scalafmt.conf
). The configuration file defines the formatting rules to be applied to the Scala code. This flag is optional, and if it is not provided,scalafmt
will search for a configuration file in the current directory and its parents. -
--mode diff
: This flag specifies the mode in whichscalafmt
operates. Thediff
mode is used to only format the changes made to the Scala code since the last formatting. It avoids reformatting the whole codebase and only applies the necessary changes to ensure consistent formatting.
Overall, the command scalafmt --config ${path-to--scalafmt-conf} --mode diff
will format the changes made to the Scala code according to the specified scalafmt
configuration file.