1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<job>
<script src="jslint-core.js" language="javascript"></script>
<script language="javascript">
/*global JSLINT load readline WScript */
var readSTDIN = function() {
var line,
input = [],
emptyCount = 0,
i;
var stdIn = WScript.stdIn,
stdOut = WScript.stdOut;
while (!stdIn.atEndofStream) {
line = stdIn.readLine();
input.push(line);
}
return input.join("\n");
};
var body = readSTDIN() || arguments[0],
ok = JSLINT(body),
i,
error,
errorType,
nextError,
errorCount,
WARN = 'WARNING',
ERROR = 'ERROR';
if (!ok) {
errorCount = JSLINT.errors.length;
for (i = 0; i < errorCount; i += 1) {
error = JSLINT.errors[i];
errorType = WARN;
if (error && error.reason && error.reason.match(/^Stopping/) === null) {
// If jslint stops next, this was an actual error
if (nextError && nextError.reason && nextError.reason.match(/^Stopping/) !== null) {
errorType = ERROR;
}
WScript.echo([error.line, error.character, errorType, error.reason].join(":"));
}
}
}
</script>
</job>
|