<commit_before>package net.happygiraffe.jslint.ant;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;

import net.happygiraffe.jslint.Issue;
import net.happygiraffe.jslint.JSLint;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.MatchingTask;

/**
 * Run {@link JSLint} over a tree of files in order to pick holes in your
 * JavaScript. This task defaults to reading *.js files.
 * 
 * <p>
 * Example build.xml usage:
 * 
 * <pre>
 * &lt;taskdef name=&quot;jslint&quot; classname=&quot;net.happygiraffe.jslint.ant.JSLintTask&quot; /&gt;
 * &lt;jslint dir=&quot;web/js&quot; /&gt;
 * </pre>
 * 
 * @author dom
 * @version $Id$
 * @see <a href="http://jslint.com/">jslint.com</a>
 */
public class JSLintTask extends MatchingTask {

    private File dir;

    private JSLint lint;

    public void setDir(File dir) {
        this.dir = dir;
    }

    /**
     * Create a new {@link JSLint} object. Set the default includes parameter to
     * <code>**<span>/</span>*.js</code>.
     */
    @Override
    public void init() throws BuildException {
        try {
            lint = new JSLint();
        } catch (IOException e) {
            throw new BuildException(e);
        }

        // Default to "*.js" anywhere in dir.
        setIncludes("**/*.js");
    }

    /**
     * Scan the specified directory for JavaScript files and lint them.
     */
    @Override
    public void execute() throws BuildException {
        if (dir == null) {
            throw new BuildException("dir must be specified");
        }

        log("dir = " + dir, Project.MSG_DEBUG);<commit_msg>Add some Javadoc.<commit_after>package net.happygiraffe.jslint.ant;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;

import net.happygiraffe.jslint.Issue;
import net.happygiraffe.jslint.JSLint;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.MatchingTask;

/**
 * Run {@link JSLint} over a tree of files in order to pick holes in your
 * JavaScript. This task defaults to reading *.js files.
 * 
 * <p>
 * Example build.xml usage:
 * 
 * <pre>
 * &lt;taskdef name=&quot;jslint&quot; classname=&quot;net.happygiraffe.jslint.ant.JSLintTask&quot; /&gt;
 * &lt;jslint dir=&quot;web/js&quot; /&gt;
 * </pre>
 * 
 * @author dom
 * @version $Id$
 * @see <a href="http://jslint.com/">jslint.com</a>
 */
public class JSLintTask extends MatchingTask {

    private File dir;

    private JSLint lint;

    /**
     * Specify a directory to scan for JavaScript problems.
     * 
     * @param dir
     */
    public void setDir(File dir) {
        this.dir = dir;
    }

    /**
     * Create a new {@link JSLint} object. Set the default includes parameter to
     * <code>**<span>/</span>*.js</code>.
     */
    @Override
    public void init() throws BuildException {
        try {
            lint = new JSLint();
        } catch (IOException e) {
            throw new BuildException(e);
        }

        // Default to "*.js" anywhere in dir.
        setIncludes("**/*.js");
    }

    /**
     * Scan the specified directory for JavaScript files and lint them.
     */
    @Override
    public void execute() throws BuildException {
        if (dir == null) {
            throw new BuildException("dir must be specified");
        }

        log("dir = " + dir, Project.MSG_DEBUG);
{'fraction_non_alphanumeric': 0.13117770767613038, 'fraction_numerical': 0.0, 'mean_word_length': 2.793619142572283, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4145542', 'n_tokens_mistral': 1263, 'n_tokens_neox': 1214, 'n_words': 315}