<commit_before>/*
 * Copyright (c) 2011-2013, Yahoo! Inc.  All rights reserved.
 * Copyrights licensed under the New BSD License.
 * See the accompanying LICENSE file for terms.
 */
'use strict';

var lintifier = require('./lib/lintifier'),
    reporter = require('./lib/reporter'),
    config = require('./config'),
    log = require('./lib/log'),
    usage;


function main(env, cb) {
    var exclude = config.exclude.always.concat(env.opts.exclude || []),
        type = env.args.shift() || '',
        sources = env.args.concat(),
        output = reporter(env, cb); // to format & output lint data

    if (env.opts.loglevel) {
        log.level = env.opts.loglevel;
    }

    // BC
    switch (type.toLowerCase()) {
    case 'app':
        break;
    case 'mojit':
        // todo: convert mojit to source path(s)
        break;
    case 'mojito':
        sources = [env.mojito.path];
        break;
    default:
        // no known type provided, assume pathname
        sources.unshift(type || env.cwd);
        type = 'app';
    }

    // directories to exclude
    exclude = exclude.concat(config.exclude[type]);

    // exec
    lintifier(sources, exclude, output);
}


module.exports = main;

module.exports.usage = usage = [
    'Usage: mojito jslint [options] [type] [source]',
    '  type    "app", "mojit", or "mojito"',
    '  source  mojit name or path',
    '',
    'Options:',
    '  --directory          directory to save results. Default is artifacts/jslint',
    '  -d                   short for --directory',
    '  --exclude <pattern>  pattern of pathnames to exclude from linting',
    '  -e <pattern>         short for -e',
    '  --print              print results to stdout ',
    '  -p                   short for --print',
    '',
    'Examples:',
    '  Run jslint on the app in the current directory',
    '    mojito jslint app',
    '',
    '  Run jslint on mojits/Bar',
    '    mojito jslint mojit mojits/Bar',
    '',
    '  Run jslint on the mojito framework',
    '    mojito jslint mojito'
].join('\n');

module.exports.options = [
    {shortName: 'd', hasValue: true, longName: 'directory'},
    {shortName: 'e', hasValue: [String, Array],  longName: 'exclude'},
    {shortName: 'p', hasValue: false, longName: 'print'}
];
<commit_msg>fail if type "mojito", and there is no mojito<commit_after>/*
 * Copyright (c) 2011-2013, Yahoo! Inc.  All rights reserved.
 * Copyrights licensed under the New BSD License.
 * See the accompanying LICENSE file for terms.
 */
'use strict';

var lintifier = require('./lib/lintifier'),
    reporter = require('./lib/reporter'),
    config = require('./config'),
    log = require('./lib/log'),
    usage;


function main(env, cb) {
    var exclude = config.exclude.always.concat(env.opts.exclude || []),
        type = env.args.shift() || '',
        sources = env.args.concat(),
        output = reporter(env, cb); // to format & output lint data

    if (env.opts.loglevel) {
        log.level = env.opts.loglevel;
    }

    // BC
    switch (type.toLowerCase()) {
    case 'app':
        break;
    case 'mojit':
        // todo: convert mojit to source path(s)
        break;
    case 'mojito':
        if (!env.mojito) {
        	cb('Mojito is not avalaible. Please install it.');
        	return;
        }
        sources = [env.mojito.path];
        break;

    default:
        // no known type provided, assume pathname
        sources.unshift(type || env.cwd);
        type = 'app';
    }

    // directories to exclude
    exclude = exclude.concat(config.exclude[type]);

    // exec
    lintifier(sources, exclude, output);
}


module.exports = main;

module.exports.usage = usage = [
    'Usage: mojito jslint [options] [type] [source]',
    '  type    "app", "mojit", or "mojito"',
    '  source  mojit name or path',
    '',
    'Options:',
    '  --directory          directory to save results. Default is artifacts/jslint',
    '  -d                   short for --directory',
    '  --exclude <pattern>  pattern of pathnames to exclude from linting',
    '  -e <pattern>         short for -e',
    '  --print              print results to stdout ',
    '  -p                   short for --print',
    '',
    'Examples:',
    '  Run jslint on the app in the current directory',
    '    mojito jslint app',
    '',
    '  Run jslint on mojits/Bar',
    '    mojito jslint mojit mojits/Bar',
    '',
    '  Run jslint on the mojito framework',
    '    mojito jslint mojito'
].join('\n');

module.exports.options = [
    {shortName: 'd', hasValue: true, longName: 'directory'},
    {shortName: 'e', hasValue: [String, Array],  longName: 'exclude'},
    {shortName: 'p', hasValue: false, longName: 'print'}
];

{'fraction_non_alphanumeric': 0.14643995749202976, 'fraction_numerical': 0.0034006376195536664, 'mean_word_length': 2.1732973701955496, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2693579', 'n_tokens_mistral': 1538, 'n_tokens_neox': 1502, 'n_words': 426}