public class JSLintTask
extends org.apache.tools.ant.Task
JSLint over a tree of files in order to pick holes in your
JavaScript.
Example build.xml usage:
<project name="build-test" xmlns:jsl="antlib:com.googlecode.jslint4java">
<target name="jslint">
<jsl:jslint options="es5">
<formatter type="plain" />
<fileset dir="." includes="*.js" excludes="*.pack.js" />
</jsl:jslint>
</target>
</project
You have to specify one or more nested fileset elements. You may optionally specify a formatter element in order to generate output (as opposed to just a build failed message). Usually, you will want the plain formatter, but in case you want to generate a report, the xml formatter mighht be useful.
encodinghaltOnFailureoptionsOption names. No default.timeout
FormatterElement| Constructor and Description |
|---|
JSLintTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(org.apache.tools.ant.types.ResourceCollection rc)
Check the contents of this
ResourceCollection. |
void |
addConfiguredFormatter(FormatterElement fe)
Add in a
ResultFormatter through the medium of a
FormatterElement. |
void |
addPredef(PredefElement predef)
Capture a predef element.
|
void |
applyOptions(JSLint lint) |
void |
execute()
Scan the specified directories for JavaScript files and lint them.
|
JSLint |
makeLint()
Create a new
JSLint object. |
void |
setEncoding(String encoding)
Set the encoding of the source files that JSLint will read.
|
void |
setFailureProperty(String failureProperty)
The name of a property to set upon failure.
|
void |
setHaltOnFailure(boolean haltOnFailure)
Should the build stop if JSLint fails? Defaults to true.
|
void |
setJslint(File jslint)
Specify an alternative version of jslint.
|
void |
setOptions(String optionList)
Set the options for running JSLint.
|
void |
setTimeout(long timeout)
Set the maximum time JSLint can run for in seconds.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypepublic void add(org.apache.tools.ant.types.ResourceCollection rc)
ResourceCollection.rc - Any kind of resource collection, e.g. fileset.public void addConfiguredFormatter(FormatterElement fe)
ResultFormatter through the medium of a
FormatterElement.fe - public void addPredef(PredefElement predef)
public void applyOptions(JSLint lint)
public void execute()
throws org.apache.tools.ant.BuildException
execute in class org.apache.tools.ant.Taskorg.apache.tools.ant.BuildExceptionpublic JSLint makeLint() throws org.apache.tools.ant.BuildException
JSLint object.org.apache.tools.ant.BuildExceptionpublic void setEncoding(String encoding)
file.encoding property). If that isn't present, default to
UTF-8.encoding - a valid charset identifier.public void setFailureProperty(String failureProperty)
public void setJslint(File jslint)
public void setHaltOnFailure(boolean haltOnFailure)
haltOnFailure - public void setOptions(String optionList) throws org.apache.tools.ant.BuildException
Option names. The names are case-insensitive.
NB: If you want to put an Option.PREDEF in here, you should use a
<predef> child element instead. Otherwise, it could be difficult
to specify a comma separated list as an element of a comma separated
list…
org.apache.tools.ant.BuildExceptionpublic void setTimeout(long timeout)
Copyright © 2007-2013. All Rights Reserved.