1 /*jshint boss:true, evil:true */
4 // jsc ${env_home}/jsc
.js
-- ${file
} "$(cat ${file})" "{option1:true,option2:false} ${env_home}"
6 if (arguments
.length
> 3) {
7 env_home
= arguments
[3].toString().replace(/\/env
$/, '/');
9 load(env_home + "jshint.js");
11 if (typeof(JSHINT) === 'undefined
') {
12 print('jshint
: Could not load jshint
.js
, tried
"' + env_home + 'jshint.js".');
20 opts = (function(arg){
30 for (var i = 0, ii = arg.length; i < ii; i++) {
31 item = arg[i].split(':');
32 opts[item[0]] = eval(item[1]);
39 print('jshint
: No file name was provided
.');
44 print('jshint
: ' + name + ' contents were not provided to jshint
.');
48 if (!JSHINT(input, opts)) {
49 for (var i = 0, err; err = JSHINT.errors[i]; i++) {
50 print(err.reason + ' (line
: ' + err.line + ', character
: ' + err.character + ')');
51 print('> ' + (err.evidence || '').replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
56 var data = JSHINT.data();
57 if (data.unused !== undefined) {
58 for (var i = 0, unused; unused = data.unused[i]; i++) {
59 print('Unused variable
"' + unused.name + '" (line
: ' + unused.line + ')');
63 // if (data.globals !== undefined) {
64 // for (var i = 0, globals; global = data.globals[i]; i++) {
65 // print('Global variable
"' + global + '"');
69 if (data.implieds !== undefined) {
70 for (var i = 0, implied; implied = data.implieds[i]; i++) {
71 print('Implied global variable
"' + implied.name + '" (line
: ' + implied.line + ')');
75 // print('Errors
: ' + JSHINT.errors.length);
76 // print(JSHINT.report(true));