]> dev.renevier.net Git - syj.git/blob - scripts/rhino.js
include jslint
[syj.git] / scripts / rhino.js
1 // rhino.js
2 // 2009-09-11
3 /*
4 Copyright (c) 2002 Douglas Crockford  (www.JSLint.com) Rhino Edition
5 */
6
7 // This is the Rhino companion to fulljslint.js.
8
9 /*global JSLINT */
10 /*jslint rhino: true, strict: false */
11
12 (function (a) {
13     var e, i, input;
14     if (!a[0]) {
15         print("Usage: jslint.js file.js");
16         quit(1);
17     }
18     input = readFile(a[0]);
19     if (!input) {
20         print("jslint: Couldn't open file '" + a[0] + "'.");
21         quit(1);
22     }
23     if (!JSLINT(input, {bitwise: true, eqeqeq: true, immed: true,
24             newcap: true, nomen: true, onevar: true, plusplus: true,
25             regexp: true, rhino: true, undef: true, white: true})) {
26         for (i = 0; i < JSLINT.errors.length; i += 1) {
27             e = JSLINT.errors[i];
28             if (e) {
29                 print('Lint at line ' + e.line + ' character ' +
30                         e.character + ': ' + e.reason);
31                 print((e.evidence || '').
32                         replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"));
33                 print('');
34             }
35         }
36         quit(2);
37     } else {
38         print("jslint: No problems found in " + a[0]);
39         quit();
40     }
41 }(arguments));