<commit_before>/**
 * Copyright (c) 2012, Yahoo! Inc.  All rights reserved.
 * Copyright (c) 2013, <NAME> and other contributors. All rights reserved.
 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
 */

/*global phantom, YSLOW*/
/*jslint browser: true, evil: true, sloppy: true, regexp: true*/

/**
 * JSLint is tolerating evil because there's a Function constructor needed to
 * inject the content coming from phantom arguments and page resources which is
 * later evaluated into the page in order to run YSlow.
 */

// For using yslow in phantomjs, see instructions @ http://yslow.org/phantomjs/

// parse args
var i, arg, page, urlCount, viewport,
    webpage = require('webpage'),
    args = phantom.args,
    len = args.length,
    urls = [],
    yslowArgs = {
        info: 'all',
        format: 'json',
        ruleset: 'ydefault',
        beacon: false,
        ua: false,
        viewport: false,
        headers: false,
        console: 0,
        threshold: 80,
        cdns: ''
    },
    unaryArgs = {
        help: false,
        version: false,
        dict: false,
        verbose: false
    },
    argsAlias = {
        i: 'info',
        f: 'format',
        r: 'ruleset',
        h: 'help',
        V: 'version',
        d: 'dict',
        u: 'ua',
        vp: 'viewport',
        c: 'console',
        b: 'beacon',
        v: 'verbose',
        t: 'threshold',
        ch: 'headers'
    };

// loop args
for (i = 0; i < len; i += 1) {
    arg = args[i];
    if (arg[0] !== '-') {
        // url, normalize if needed
        if (arg.indexOf('http') !== 0) {
            arg = 'http://' + arg;
        }
        urls.push(arg);
    }
    arg = arg.replace(/^\-\-?/, '');
    if (yslowArgs.hasOwnProperty(arg)) {
        // yslow argument
        i += 1;
        yslowArgs[arg] = args[i];
    } else if (yslowArgs.hasOwnProperty(argsAlias[arg])) {
        // yslow argument alias
        i += 1;
        yslowArgs[argsAlias[arg]] = args[i];<commit_msg>removed deprecated args to work with phantomjs 2 #129<commit_after>/**
 * Copyright (c) 2012, Yahoo! Inc.  All rights reserved.
 * Copyright (c) 2013, <NAME> and other contributors. All rights reserved.
 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
 */

/*global phantom, YSLOW*/
/*jslint browser: true, evil: true, sloppy: true, regexp: true*/

/**
 * JSLint is tolerating evil because there's a Function constructor needed to
 * inject the content coming from phantom arguments and page resources which is
 * later evaluated into the page in order to run YSlow.
 */

// For using yslow in phantomjs, see instructions @ http://yslow.org/phantomjs/

// parse args
var i, arg, page, urlCount, viewport,
    webpage = require('webpage'),
    system = require('system'),
    args = system.args,
    len = args.length,
    urls = [],
    yslowArgs = {
        info: 'all',
        format: 'json',
        ruleset: 'ydefault',
        beacon: false,
        ua: false,
        viewport: false,
        headers: false,
        console: 0,
        threshold: 80,
        cdns: ''
    },
    unaryArgs = {
        help: false,
        version: false,
        dict: false,
        verbose: false
    },
    argsAlias = {
        i: 'info',
        f: 'format',
        r: 'ruleset',
        h: 'help',
        V: 'version',
        d: 'dict',
        u: 'ua',
        vp: 'viewport',
        c: 'console',
        b: 'beacon',
        v: 'verbose',
        t: 'threshold',
        ch: 'headers'
    };

// loop args, skip the first arg "scripr name"
for (i = 1; i < len; i += 1) {
    arg = args[i];
    if (arg[0] !== '-') {
        // url, normalize if needed
        if (arg.indexOf('http') !== 0) {
            arg = 'http://' + arg;
        }
        urls.push(arg);
    }
    arg = arg.replace(/^\-\-?/, '');
    if (yslowArgs.hasOwnProperty(arg)) {
        // yslow argument
        i += 1;
        yslowArgs[arg] = args[i];
    } else if (yslowArgs.hasOwnProperty(argsAlias[arg])) {
        // yslow argument alias
        i += 1;
        yslowArgs[argsAlias[arg]] = args[i];
{'fraction_non_alphanumeric': 0.14296063752716734, 'fraction_numerical': 0.009176527408838444, 'mean_word_length': 1.9628040057224607, 'pattern_counts': {'":': 0, '<': 7, '<?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': '2460207', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1290, 'n_words': 417}