<commit_before>/*jshint boss: true */

load("jshint.js");

(function (args) {
    var name   = args[0],
        optstr = args[1], // arg1=val1,arg2=val2,...
        opts   = { rhino: true },
        predef = {},
        input;

    if (!name) {
        print('Usage: jshint.js file.js');
        quit(1);
    }

    if (optstr) {
        optstr.split(',').forEach(function (arg) {
            var o = arg.split('=');
            opts[o[0]] = (function (ov) {
                switch (ov) {
                case 'true':
                    return true;
                case 'false':
                    return false;
                default:
                    return ov;
                }
            })(o[1]);
        });
        if (opts.predef) {
            opts.predef.split(';').forEach(function (def) {
                var d = def.split(':');
                predef[d[0]] = (function (dv) {
                    return (dv === 'false') ? false : true;
                })(d[1]);
            });
            opts.predef = predef;
        }
    }

    input = readFile(name);

    if (!input) {
        print('jshint: Couldn\'t open file ' + name);
        quit(1);
    }

    if (!JSHINT(input, opts)) {
        for (var i = 0, err; err = JSHINT.errors[i]; i++) {
            print(err.reason + ' (' + name + ':' + err.line + ':' + err.character + ')');<commit_msg>add predef option as formal parameter<commit_after>/*jshint boss: true */

load("jshint.js");

(function (args) {
    var name   = args[0],
        optstr = args[1], // arg1=val1,arg2=val2,...
        predef = args[2], // global1=override,global2,global3,...
        opts   = { rhino: true },
        input;

    if (!name) {
        print('Usage: jshint.js file.js');
        quit(1);
    }

    if (optstr) {
        optstr.split(',').forEach(function (arg) {
            var o = arg.split('=');
            opts[o[0]] = (function (ov) {
                switch (ov) {
                case 'true':
                    return true;
                case 'false':
                    return false;
                default:
                    return ov;
                }
            })(o[1]);
        });
    }
    
    if (predef) {
    	opts.predef = {};
    	predef.split(',').forEach(function (arg) {
    		var global = arg.split('=');
    		opts.predef[global[0]] = (function (override) {
    			return (override === 'false') ? false : true;
    		})(global[1]);
    	});
    }

    input = readFile(name);

    if (!input) {
        print('jshint: Couldn\'t open file ' + name);
        quit(1);
    }

    if (!JSHINT(input, opts)) {
        for (var i = 0, err; err = JSHINT.errors[i]; i++) {
            print(err.reason + ' (' + name + ':' + err.line + ':' + err.character + ')');
{'fraction_non_alphanumeric': 0.17766497461928935, 'fraction_numerical': 0.010877447425670777, 'mean_word_length': 1.3723129836629406, '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': '3262884', 'n_tokens_mistral': 917, 'n_tokens_neox': 876, 'n_words': 186}