1 /*jshint boss: true, rhino: true */
6 optstr
, // arg1=val1,arg2=val2,...
7 predef
, // global1=override,global2,global3,...
8 opts
= { rhino
: true },
11 args
.forEach(function (arg
) {
12 if (arg
.indexOf("=") > -1) {
13 //first time it's the options
24 if (filenames
.length
=== 0) {
25 print('Usage: jshint.js file.js');
30 optstr
.split(',').forEach(function (arg
) {
31 var o
= arg
.split('=');
32 opts
[o
[0]] = (function (ov
) {
47 predef
.split(',').forEach(function (arg
) {
48 var global
= arg
.split('=');
49 opts
.predef
[global
[0]] = (function (override
) {
50 return (override
=== 'false') ? false : true;
55 filenames
.forEach(function (name
) {
57 var input
= readFile(name
);
60 print('jshint: Couldn\'t open file ' + name
);
64 if (!JSHINT(input
, opts
)) {
65 for (var i
= 0, err
; err
= JSHINT
.errors
[i
]; i
+= 1) {
66 print(err
.reason
+ ' (' + name
+ ':' + err
.line
+ ':' + err
.character
+ ')');
67 print('> ' + (err
.evidence
|| '').replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));