public interface Scalafmt
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear internal caches such as classloaded Scalafmt instances.
|
static Scalafmt |
create(java.lang.ClassLoader loader)
Classload a new instance of this Scalafmt instance.
|
java.lang.String |
format(java.nio.file.Path config,
java.nio.file.Path file,
java.lang.String code)
Format a single file with the given .scalafmt.conf configuration.
|
Scalafmt |
withDefaultVersion(java.lang.String defaultVersion)
The fallback Scalafmt version to use when there is no 'version' setting in .scalafmt.conf.
|
Scalafmt |
withMavenRepositories(java.lang.String... repositories)
Use this repositories to resolve dependencies.
|
Scalafmt |
withReporter(ScalafmtReporter reporter)
Use this reporter to report errors and information messages.
|
Scalafmt |
withRespectProjectFilters(boolean respectExcludeFilters)
Whether to respect the 'project.{excludeFilters,includeFilters}' setting in .scalafmt.conf.
|
Scalafmt |
withRespectVersion(boolean respectVersion)
Whether to respect the 'version' setting in .scalafmt.conf.
|
java.lang.String format(java.nio.file.Path config,
java.nio.file.Path file,
java.lang.String code)
config - the absolute path to the configuration file. This file must exist or
an exception will be thrown.file - relative or absolute path to the file being formatted. Used only for the path
name, the file does not have to exist on disk.code - the text contents to format.Scalafmt withRespectProjectFilters(boolean respectExcludeFilters)
respectExcludeFilters - If true (default), returns the original file contents when
formatting a file that does not matches the project settings
in .scalafmt.conf. If false, formats every file that is passed
to the format(Path, Path, String) method regardless
of .scalafmt.conf settings.Scalafmt withRespectVersion(boolean respectVersion)
respectVersion - If true (default), refuses to format files when the 'version' setting
is missing in .scalafmt.conf and users must update .scalafmt.conf to
format files. If false, falls back to the default version provided
via withDefaultVersion(String).Scalafmt withDefaultVersion(java.lang.String defaultVersion)
withRespectVersion(boolean) is true.Scalafmt withReporter(ScalafmtReporter reporter)
Scalafmt withMavenRepositories(java.lang.String... repositories)
void clear()
static Scalafmt create(java.lang.ClassLoader loader)
loader - the classloader containing the 'scalafmt-dynamic' module.java.util.NoSuchElementException - if the classloader does not have the 'scalafmt-dynamic' module.