Error:');
- if (data.errors) {
- for (i = 0; i < data.errors.length; i += 1) {
- c = data.errors[i];
- if (c) {
- e = c.evidence || '';
- o.push('
Problem' + (isFinite(c.line) ? ' at line ' +
- c.line + ' character ' + c.character : '') +
- ': ' + c.reason.entityify() +
- '
' +
- (e && (e.length > 80 ? e.slice(0, 77) + '...' :
- e).entityify()) + '
');
- }
- }
- }
-
- if (data.implieds) {
- s = [];
- for (i = 0; i < data.implieds.length; i += 1) {
- s[i] = '
' + data.implieds[i].name + ' ' +
- data.implieds[i].line + '';
- }
- o.push('
Implied global: ' + s.join(', ') + '
');
- }
-
- if (data.unused) {
- s = [];
- for (i = 0; i < data.unused.length; i += 1) {
- s[i] = '
' + data.unused[i].name + ' ' +
- data.unused[i].line + ' ' +
- data.unused[i]['function'] + '';
- }
- o.push('
Unused variable: ' + s.join(', ') + '
');
- }
- if (data.json) {
- o.push('
JSON: bad.
');
- }
- o.push('
');
- }
-
- if (!option) {
-
- o.push('');
-
- if (data.urls) {
- detail("URLs
", data.urls, '
');
- }
-
- if (data.json && !err) {
- o.push('
JSON: good.
');
- } else if (data.globals) {
- o.push('
Global ' +
- data.globals.sort().join(', ') + '
');
- } else {
- o.push('
No new global variables introduced.
');
- }
-
- for (i = 0; i < data.functions.length; i += 1) {
- f = data.functions[i];
-
- o.push('
' + f.line + '-' +
- f.last + ' ' + (f.name || '') + '(' +
- (f.param ? f.param.join(', ') : '') + ')
');
- detail('
Unused', f.unused);
- detail('Closure', f.closure);
- detail('Variable', f['var']);
- detail('Exception', f.exception);
- detail('Outer', f.outer);
- detail('Global', f.global);
- detail('Label', f.label);
- }
-
- if (data.member) {
- a = Object.keys(data.member);
- if (a.length) {
- a = a.sort();
- m = '
/*members ';
- l = 10;
- for (i = 0; i < a.length; i += 1) {
- k = a[i];
- n = k.name();
- if (l + n.length > 72) {
- o.push(m + '
');
- m = ' ';
- l = 1;
- }
- l += n.length + 2;
- if (data.member[k] === 1) {
- n = '' + n + '';
- }
- if (i < a.length - 1) {
- n += ', ';
- }
- m += n;
- }
- o.push(m + '
*/');
- }
- o.push('
');
- }
- }
- return o.join('');
- };
- itself.jshint = itself;
-
- itself.edition = '2011-04-16';
-
- return itself;
-
-}());
-
-// Make JSHINT a Node module, if possible.
-if (typeof exports == 'object' && exports)
- exports.JSHINT = JSHINT;
-
-
-
-(function (args) {
- var filenames = [],
- optstr, // arg1=val1,arg2=val2,...
- predef, // global1=override,global2,global3,...
- opts = { rhino: true },
- retval = 0;
-
- args.forEach(function(arg){
- if (arg.indexOf("=") > -1){
- //first time it's the options
- if (!optstr){
- optstr = arg;
- } else if (!predef) {
- predef = arg;
- }
- } else {
- filenames.push(arg);
- }
- });
-
- if (filenames.length === 0) {
- 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]);
- });
- }
-
- filenames.forEach(function(name){
-
- var 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 + ')');
- print('> ' + (err.evidence || '').replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
- print('');
- }
- retval = 1;
- }
- });
-
- quit(retval);
-}(arguments));
+#!/usr/bin/env rhino
+var global=this,cmdline_args=Array.prototype.slice.call(arguments),JSHINT;"undefined"==typeof window&&(window={}),function(){var t;t=function e(n,r,i){function o(a,c){if(!r[a]){if(!n[a]){var u="function"==typeof t&&t;if(!c&&u)return u(a,!0);if(s)return s(a,!0);var l=new Error("Cannot find module '"+a+"'");throw l.code="MODULE_NOT_FOUND",l}var f=r[a]={exports:{}};n[a][0].call(f.exports,function(t){var e=n[a][1][t];return o(e?e:t)},f,f.exports,e,n,r,i)}return r[a].exports}for(var s="function"==typeof t&&t,a=0;a