<commit_before>/*jshint boss: true, evil: true */

// usage:
//   jsc ${envHome}/jsc.js -- ${lineCount} {option1:true,option2:false} ${envHome}
var envHome = '';

if (arguments.length > 2) {
    envHome = arguments[2].toString().replace(/\/env$/, '/');
}

load(envHome + "jshint.js");

if (typeof(JSHINT) === 'undefined') {
    print('jshint: Could not load jshint.js, tried "' + envHome + 'jshint.js".');
    quit();
}

var process = function(args) {
    var lineCount = parseInt(args[0], 10),
        opts  = (function(arg){
            switch (arg) {
            case undefined:
            case '':
                return {};
            default:
                return eval('(' + arg + ')');
            }
        })(args[1]);

    if (!lineCount) {
        print('jshint: Must provide number of lines to read from stdin.');
        quit();
    }

    var input = '',
        i;

    for (i = 0; i < lineCount; ++i) {
        input += readline() + '\n';
    }

    var results = [];

    if (!JSHINT(input, opts)) {
        var err;

        for (i = 0; err = JSHINT.errors[i]; i++) {
            results.push(err);
        }
    }

    print(JSON.stringify(results));
    quit();
};

process(arguments);<commit_msg>Don't add extra \n at the end<commit_after>/*jshint boss: true, evil: true */

// usage:
//   jsc ${envHome}/jsc.js -- ${lineCount} {option1:true,option2:false} ${envHome}
var envHome = '';

if (arguments.length > 2) {
    envHome = arguments[2].toString().replace(/\/env$/, '/');
}

load(envHome + "jshint.js");

if (typeof(JSHINT) === 'undefined') {
    print('jshint: Could not load jshint.js, tried "' + envHome + 'jshint.js".');
    quit();
}

var process = function(args) {
    var lineCount = parseInt(args[0], 10),
        opts  = (function(arg){
            switch (arg) {
            case undefined:
            case '':
                return {};
            default:
                return eval('(' + arg + ')');
            }
        })(args[1]);

    if (!lineCount) {
        print('jshint: Must provide number of lines to read from stdin.');
        quit();
    }

    var input = '',
        i;

    // For all but the last line we add \n
    --lineCount;

    for (i = 0; i < lineCount; ++i) {
        input += readline() + '\n';
    }

    // Now read the last line without appending \n
    input += readline();

    var results = [];

    if (!JSHINT(input, opts)) {
        var err;

        for (i = 0; err = JSHINT.errors[i]; i++) {
            results.push(err);
        }
    }

    print(JSON.stringify(results));
    quit();
};

process(arguments);
{'fraction_non_alphanumeric': 0.18181818181818182, 'fraction_numerical': 0.007704160246533128, 'mean_word_length': 1.921259842519685, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4377320', 'n_tokens_mistral': 879, 'n_tokens_neox': 851, 'n_words': 213}