Skip to content

Commit

Permalink
issue 68: add timeout to maven plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
happygiraffe committed Sep 16, 2011
1 parent 6848ba1 commit 7f59b59
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ public class JSLintMojo extends AbstractMojo {
*/
private File jslintSource;

/**
* How many seconds JSLint is allowed to run.
*
* @parameter expression="${jslint.timeout}"
*/
private long timeout;

/** Add a single option. For testing only. */
void addOption(Option sloppy, String value) {
options.put(sloppy.name().toLowerCase(Locale.ENGLISH), value);
Expand Down Expand Up @@ -181,6 +188,9 @@ public void execute() throws MojoExecutionException, MojoFailureException {

private JSLint applyJSlintSource() throws MojoExecutionException {
JSLintBuilder builder = new JSLintBuilder();
if (timeout > 0) {
builder.timeout(timeout);
}
if (jslintSource != null) {
try {
return builder.fromFile(jslintSource, Charset.forName(encoding));
Expand Down

0 comments on commit 7f59b59

Please sign in to comment.