snippetbashTip
scalafmt — Code formatter for Scala. Configurations are stored in the `.scalafmt.conf` file. More information:
Viewed 0 times
formatterscalafmtcommandconfigurationsscalaclicodefor
Problem
How to use the
scalafmt command: Code formatter for Scala. Configurations are stored in the .scalafmt.conf file. More information: <https://scalameta.org/scalafmt/>.Solution
scalafmt — Code formatter for Scala. Configurations are stored in the .scalafmt.conf file. More information: <https://scalameta.org/scalafmt/>.Reformat all
.scala files in the current directory recursively:scalafmtReformat specific files or directories with a custom formatting configuration:
scalafmt --config {{path/to/.scalafmt.conf}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}Check if files are correctly formatted, returning
0 if all files respect the formatting style:scalafmt --config {{path/to/.scalafmt.conf}} --testExclude files or directories:
scalafmt --exclude {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}Format only files that were edited against the current Git branch:
scalafmt --config {{path/to/.scalafmt.conf}} --mode diffCode Snippets
Reformat all `.scala` files in the current directory recursively
scalafmtReformat specific files or directories with a custom formatting configuration
scalafmt --config {{path/to/.scalafmt.conf}} {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}Check if files are correctly formatted, returning `0` if all files respect the formatting style
scalafmt --config {{path/to/.scalafmt.conf}} --testExclude files or directories
scalafmt --exclude {{path/to/file_or_directory1 path/to/file_or_directory2 ...}}Format only files that were edited against the current Git branch
scalafmt --config {{path/to/.scalafmt.conf}} --mode diffContext
tldr-pages: common/scalafmt
Revisions (0)
No revisions yet.