<commit_before>/*jslint node: true, nomen: true, sloppy: true*/

var cp = require('child_process'),
    fs = require('fs'),
    tests,
    command,
    exitCode = 0;

// Execute requirejs optimizer
cp.exec('node ' + __dirname + '/../vendor/r.js/dist/r.js -o ' + __dirname + '/Classify.build.js', function (error, stdout, stderr) {

    // Print success or error
    if (error !== null) {
        console.error(stderr);
        exitCode = 1;
    } else {
        console.log(stdout);
    }

    // Remove other files
    var files = fs.readdirSync(__dirname + '/../dist'),
        distDir = __dirname + '/../dist/';

    files.forEach(function (file) {

        var code;

        if (file.substr(file.length - 3) === ".js" && file !== "Classify.js") {
            console.log("Deleting " + file);
            code = fs.unlinkSync(distDir + file);

            if (code === 0) {
                exitCode = 1;
            }
        }
    });

    // Exit if something went badly
    if (exitCode) {
        process.exit(exitCode);
    }

    // Run tests
    command = 'mocha -R list ' + __dirname + '/../test/Classify.test.js';

    if (process.platform === 'win32') {
        tests = cp.spawn('cmd', ['/s', '/c', command], { customFds: [0, 1, 2] });
    } else {
        tests = cp.spawn('sh', ['-c', command], { customFds: [0, 1, 2] });
    }<commit_msg>Add error message and fix CS.<commit_after>/*jslint node: true, nomen: true, sloppy: true*/

var cp = require('child_process'),
    fs = require('fs'),
    tests,
    command,
    exitCode = 0;

// Execute requirejs optimizer
cp.exec('node ' + __dirname + '/../vendor/r.js/dist/r.js -o ' + __dirname + '/Classify.build.js', function (error, stdout, stderr) {

    // Print success or error
    if (error !== null) {
        console.error(stderr);
        exitCode = 1;
    } else {
        console.log(stdout);
    }

    // Remove other files
    var files = fs.readdirSync(__dirname + '/../dist'),
        distDir = __dirname + '/../dist/';

    files.forEach(function (file) {

        var code;

        if (file.substr(file.length - 3) === '.js' && file !== 'Classify.js') {
            console.log('Deleting ' + file);
            code = fs.unlinkSync(distDir + file);

            if (code === 0) {
                console.error('Unable to delete file.');
                exitCode = 1;
            }
        }
    });

    // Exit if something went badly
    if (exitCode) {
        process.exit(exitCode);
    }

    // Run tests
    command = 'mocha -R list ' + __dirname + '/../test/Classify.test.js';

    if (process.platform === 'win32') {
        tests = cp.spawn('cmd', ['/s', '/c', command], { customFds: [0, 1, 2] });
    } else {
        tests = cp.spawn('sh', ['-c', command], { customFds: [0, 1, 2] });
    }
{'fraction_non_alphanumeric': 0.181099532878189, 'fraction_numerical': 0.009342436219906576, 'mean_word_length': 1.9274447949526814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '3162940', 'n_tokens_mistral': 948, 'n_tokens_neox': 900, 'n_words': 225}