initial jshint commit. including the library, made a runner for jasmine.
This commit is contained in:
parent
545752ae20
commit
9f90c4eca5
5918
jshint/jshint.js
Executable file
5918
jshint/jshint.js
Executable file
File diff suppressed because it is too large
Load Diff
42
jshint/run.js
Normal file
42
jshint/run.js
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
var fs = require("fs")
|
||||||
|
var sys = require("sys")
|
||||||
|
var path = require("path")
|
||||||
|
var JSHINT = require("./jshint").JSHINT;
|
||||||
|
|
||||||
|
function isVendorFile(fullPath) {
|
||||||
|
var fileName = path.basename(fullPath)
|
||||||
|
var vendorFiles = ["json2.js", "jshint.js", "publish.js"]
|
||||||
|
for (var i=0; i<vendorFiles.length; i++) if (fileName==vendorFiles[i]) return true
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function allJasmineJsFiles(rootDir) {
|
||||||
|
var files = []
|
||||||
|
var things = fs.readdirSync(rootDir)
|
||||||
|
for (var i=0; i<things.length; i++) {
|
||||||
|
var thing = things[i]
|
||||||
|
var fullPath = rootDir + "/" + thing
|
||||||
|
if (fs.statSync(fullPath).isDirectory()) {
|
||||||
|
files = files.concat(allJasmineJsFiles(fullPath))
|
||||||
|
} else {
|
||||||
|
if (fullPath.match(/\.js$/) && !isVendorFile(fullPath)) files.push(fullPath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return files
|
||||||
|
}
|
||||||
|
|
||||||
|
var jasmineJsFiles = allJasmineJsFiles(".")
|
||||||
|
|
||||||
|
var jasmineJsHintConfig = {}
|
||||||
|
var jasmineGlobals = {}
|
||||||
|
|
||||||
|
|
||||||
|
for(var i=0; i<jasmineJsFiles.length; i++) {
|
||||||
|
var file = jasmineJsFiles[i]
|
||||||
|
var result = JSHINT(fs.readFileSync(file, "utf8"))
|
||||||
|
if (!result) {
|
||||||
|
console.log("JSHINT failure: ", file)
|
||||||
|
console.log(JSHINT.data().errors)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user