summaryrefslogtreecommitdiff
path: root/tools/run-lint.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/run-lint.js')
-rwxr-xr-xtools/run-lint.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/run-lint.js b/tools/run-lint.js
new file mode 100755
index 0000000..89e6d8f
--- /dev/null
+++ b/tools/run-lint.js
@@ -0,0 +1,36 @@
+#!/usr/bin/env seed
+
+Gio = imports.gi.Gio;
+
+Seed.include("jslint.js");
+
+function runLint(filename)
+{
+ var read_file = Gio.simple_read(filename);
+
+ read_file = read_file.replace("#!/usr/bin/env seed","");
+
+ if(JSLINT(read_file, {white:false, passfail: false, eqeqeq: false, forin: false}))
+ return;
+
+ print("################################################################################");
+ print(" " + filename);
+
+ for(no in JSLINT.errors)
+ {
+ var err = JSLINT.errors[no];
+
+ if(!err || !err.reason)
+ continue;
+
+ printf("%d:%d\t%s",err.line,err.character,err.reason);
+ }
+
+ return JSLINT.errors.length;
+}
+
+for(a in Seed.argv)
+{
+ if(a >= 2)
+ runLint(Seed.argv[a]);
+}