]> khamidou — GitHub mirrors - popcorn-js.git/commitdiff
[#354] pass a list of files to lint from the Makefile to jslint-check.js, and fix...
authorDaniel Brooks <db48x@db48x.net>
Mon, 21 Feb 2011 16:29:12 +0000 (10:29 -0600)
committerDaniel Brooks <db48x@db48x.net>
Mon, 21 Feb 2011 16:29:12 +0000 (10:29 -0600)
Makefile
build/jslint-check.js

index 69b6e0591a12089f8f920970b9f8992c7f356c89..eca8f0a04df6fbb61f12636c4fd58f366e207747 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -47,7 +47,7 @@ ${POPCORN_MIN}: ${POPCORN_DIST}
 
 lint: ${POPCORN_DIST}
        @@echo "Checking Popcorn against JSLint..."
-       @@${RHINO} build/jslint-check.js        
+       @@${RHINO} build/jslint-check.js popcorn.js ${PLUGINS_SRC}
        
 clean:
        @@echo "Removing Distribution directory:" ${DIST_DIR}
@@ -109,6 +109,3 @@ ${PLUGINS_MIN}: ${PLUGINS_DIST}
        @@${MINJAR} --js ${PLUGINS_DIST} --warning_level QUIET --js_output_file ${PLUGINS_MIN}.tmp
        @@cat ${PLUGINS_MIN}.tmp >> ${PLUGINS_MIN}
        @@rm -f ${PLUGINS_MIN}.tmp      
-
-
-
index 162a8022a89f76d1db471adf01427f8a9c13755e..7afb7a4c57a034be27910bbe7520919f0838d5c9 100644 (file)
@@ -1,9 +1,5 @@
 load("build/jslint.js");
 
-var src = readFile("popcorn.js");
-
-JSLINT(src, { evil: true, forin: true, maxerr: 100 });
-
 // All of the following are known issues that we think are 'ok'
 // (in contradiction with JSLint) more information here:
 // http://docs.jquery.com/JQuery_Core_Style_Guidelines
@@ -16,21 +12,31 @@ var ok = {
   "'e' is already defined.": true
 };
 
-var e = JSLINT.errors, found = 0, w;
+function check(src)
+{
+  var e = JSLINT.errors, found = 0, w;
+
+  JSLINT(src, { evil: true, forin: true, maxerr: 100 });
 
-for ( var i = 0; i < e.length; i++ ) {
-  w = e[i];
+  for ( var i = 0; e && i < e.length; i++ ) {
+    w = e[i];
 
-  if ( !ok[ w.reason ] ) {
-    found++;
-    print( "\n" + w.evidence + "\n" );
-    print( "    Problem at line " + w.line + " character " + w.character + ": " + w.reason );
+    if ( w && !ok[ w.reason ] ) {
+      found++;
+      print( "\n" + w.evidence + "\n" );
+      print( "    Problem at line " + w.line + " character " + w.character + ": " + w.reason );
+    }
+  }
+  
+  if ( found > 0 ) {
+    print( "\n" + found + " Error(s) found." );
+  } else {
+    print( "JSLint check passed." );
   }
 }
 
-if ( found > 0 ) {
-  print( "\n" + found + " Error(s) found." );
-
-} else {
-  print( "JSLint check passed." );
+for each (var f in arguments)
+{
+  print( "Linting "+ f );
+  check(readFile(f));
 }