com.googlecode.jslint4java
Class JSLint

java.lang.Object
  extended by com.googlecode.jslint4java.JSLint

public class JSLint
extends Object

A utility class to check JavaScript source code for potential problems.

Author:
dom
See Also:
Construction of JSLint

Method Summary
 void addOption(Option o)
          Add an option to change the behaviour of the lint.
 void addOption(Option o, String arg)
          Add an option to change the behaviour of the lint.
 String getEdition()
          Return the version of jslint in use.
 JSLintResult lint(String systemId, Reader reader)
          Check for problems in a Reader which contains JavaScript source.
 JSLintResult lint(String systemId, String javaScript)
          Check for problems in JavaScript source.
 String report(String javaScript)
          Report on what variables / functions are in use by this code.
 String report(String javaScript, boolean errorsOnly)
          Report on what variables / functions are in use by this code.
 void resetOptions()
          Clear out all options that have been set with addOption(Option).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addOption

public void addOption(Option o)
Add an option to change the behaviour of the lint. This will be passed in with a value of "true".

Parameters:
o - Any Option.

addOption

public void addOption(Option o,
                      String arg)
Add an option to change the behaviour of the lint. The option will be parsed as appropriate using an OptionParser.

Parameters:
o - Any Option.
arg - The value to associate with o.

getEdition

public String getEdition()
Return the version of jslint in use.


lint

public JSLintResult lint(String systemId,
                         Reader reader)
                  throws IOException
Check for problems in a Reader which contains JavaScript source.

Parameters:
systemId - a filename
reader - a Reader over JavaScript source code.
Returns:
a JSLintResult.
Throws:
IOException

lint

public JSLintResult lint(String systemId,
                         String javaScript)
Check for problems in JavaScript source.

Parameters:
systemId - a filename
javaScript - a String of JavaScript source code.
Returns:
a JSLintResult.

report

public String report(String javaScript)
Report on what variables / functions are in use by this code.

Parameters:
javaScript -
Returns:
an HTML report.

report

public String report(String javaScript,
                     boolean errorsOnly)
Report on what variables / functions are in use by this code.

Parameters:
javaScript -
errorsOnly - If a report consisting solely of the problems is desired.
Returns:
an HTML report.

resetOptions

public void resetOptions()
Clear out all options that have been set with addOption(Option).



Copyright © 2007-2012. All Rights Reserved.