public abstract class SpotlessExtension extends Object
Modifier and Type | Field and Description |
---|---|
protected static String |
APPLY_DESCRIPTION |
protected static String |
CHECK_DESCRIPTION |
protected static String |
TASK_GROUP |
Modifier | Constructor and Description |
---|---|
protected |
SpotlessExtension(Project project) |
Modifier and Type | Method and Description |
---|---|
void |
antlr4(Action<Antlr4Extension> closure)
Configures the special antlr4-specific extension for antlr4 files.
|
void |
cpp(Action<CppExtension> closure)
Configures the special C/C++-specific extension.
|
protected abstract void |
createFormatTasks(String name,
FormatExtension formatExtension) |
void |
encoding(String charset)
Sets encoding to use (defaults to UTF_8).
|
void |
format(String name,
Action<FormatExtension> closure)
Configures a custom extension.
|
<T extends FormatExtension> |
format(String name,
Class<T> clazz,
Action<T> configure) |
void |
freshmark(Action<FreshMarkExtension> closure)
Configures the special freshmark-specific extension.
|
Charset |
getEncoding()
Returns the encoding to use.
|
LineEnding |
getLineEndings() |
String |
getRatchetFrom() |
void |
groovy(Action<GroovyExtension> closure)
Configures the special groovy-specific extension.
|
void |
groovyGradle(Action<GroovyGradleExtension> closure)
Configures the special groovy-specific extension for Gradle files.
|
boolean |
isEnforceCheck()
Returns
true if Gradle’s check task should run spotlessCheck ; false otherwise. |
void |
java(Action<JavaExtension> closure)
Configures the special java-specific extension.
|
void |
kotlin(Action<KotlinExtension> closure)
Configures the special kotlin-specific extension.
|
void |
kotlinGradle(Action<KotlinGradleExtension> closure)
Configures the special Gradle Kotlin DSL specific extension.
|
protected <T extends FormatExtension> |
maybeCreate(String name,
Class<T> clazz) |
void |
python(Action<PythonExtension> closure)
Configures the special python-specific extension for python files.
|
void |
ratchetFrom(String ratchetFrom) |
void |
removeFormat(String name)
Makes it possible to remove a format which was created earlier.
|
void |
scala(Action<ScalaExtension> closure)
Configures the special scala-specific extension.
|
void |
setEncoding(Charset charset)
Sets encoding to use (defaults to UTF_8).
|
void |
setEncoding(String name)
Sets encoding to use (defaults to UTF_8).
|
void |
setEnforceCheck(boolean enforceCheck)
Configures Gradle’s
check task to run spotlessCheck if true ,
but to not do so if false . |
void |
setLineEndings(LineEnding lineEndings) |
void |
setRatchetFrom(String ratchetFrom)
Limits the target to only the files which have changed since the given git reference,
which is resolved according to this
|
void |
sql(Action<SqlExtension> closure)
Configures the special sql-specific extension for SQL files.
|
void |
typescript(Action<TypescriptExtension> closure)
Configures the special typescript-specific extension for typescript files.
|
protected static final String TASK_GROUP
protected static final String CHECK_DESCRIPTION
protected static final String APPLY_DESCRIPTION
protected SpotlessExtension(Project project)
public LineEnding getLineEndings()
public void setLineEndings(LineEnding lineEndings)
public Charset getEncoding()
Returns the encoding to use.
public void setEncoding(String name)
Sets encoding to use (defaults to UTF_8).
public void setEncoding(Charset charset)
Sets encoding to use (defaults to UTF_8).
public void encoding(String charset)
Sets encoding to use (defaults to UTF_8).
public void setRatchetFrom(String ratchetFrom)
Limits the target to only the files which have changed since the given git reference, which is resolved according to this
@Nullable public String getRatchetFrom()
setRatchetFrom(String)
public void ratchetFrom(String ratchetFrom)
setRatchetFrom(String)
public void java(Action<JavaExtension> closure)
Configures the special java-specific extension.
public void scala(Action<ScalaExtension> closure)
Configures the special scala-specific extension.
public void kotlin(Action<KotlinExtension> closure)
Configures the special kotlin-specific extension.
public void kotlinGradle(Action<KotlinGradleExtension> closure)
Configures the special Gradle Kotlin DSL specific extension.
public void freshmark(Action<FreshMarkExtension> closure)
Configures the special freshmark-specific extension.
public void groovy(Action<GroovyExtension> closure)
Configures the special groovy-specific extension.
public void groovyGradle(Action<GroovyGradleExtension> closure)
Configures the special groovy-specific extension for Gradle files.
public void sql(Action<SqlExtension> closure)
Configures the special sql-specific extension for SQL files.
public void cpp(Action<CppExtension> closure)
Configures the special C/C++-specific extension.
public void typescript(Action<TypescriptExtension> closure)
Configures the special typescript-specific extension for typescript files.
public void antlr4(Action<Antlr4Extension> closure)
Configures the special antlr4-specific extension for antlr4 files.
public void python(Action<PythonExtension> closure)
Configures the special python-specific extension for python files.
public void format(String name, Action<FormatExtension> closure)
Configures a custom extension.
public void removeFormat(String name)
Makes it possible to remove a format which was created earlier.
public boolean isEnforceCheck()
Returns true
if Gradle’s check
task should run spotlessCheck
; false
otherwise.
public void setEnforceCheck(boolean enforceCheck)
Configures Gradle’s check
task to run spotlessCheck
if true
,
but to not do so if false
.
true
by default.
public <T extends FormatExtension> void format(String name, Class<T> clazz, Action<T> configure)
protected final <T extends FormatExtension> T maybeCreate(String name, Class<T> clazz)
protected abstract void createFormatTasks(String name, FormatExtension formatExtension)