LintTest.prototype.run = function()

in jones-test/lib/LintTest.js [129:169]


LintTest.prototype.run = function() {
  if(skipTests) { return this.skip("jslint not avaliable"); }

  var e, i, n=0;
  var ok, errors, msg = "";
  var data = fs.readFileSync(this.sourceFile, "utf8");  
  var result = linter(data, lintOptions);
  var nIgnored = 0;

  /* Adapt to differing APIs of jslint and jshint */
  if(typeof result === 'boolean') {
    /* We are using jshint */
    ok = result;
    errors = linter.errors;
  }
  else {
    /* jslint */
    ok = result.ok;
    errors = result.errors;
  }

  try {
    nIgnored = ignoredErrors[this.sourceFileName].length;
  } catch(ignore) { }

  if(! ok) {
    udebug.log(this.sourceFileName, "errors:", errors.length, "ignored:", nIgnored);
    for (i = 0; i < errors.length; i += 1) {
      e = errors[i];
      if(e && ! isIgnored(this.sourceFileName, e.character, e.reason)) {
        n += 1;
        msg += util.format('\n * Line %d[%d]: %s', e.line, e.character, e.reason);
      }
    }
    msg = util.format("%d lint error%s", n, n===1 ? '':'s') + msg;
    if (n > 0) {
      this.appendErrorMessage(msg);
    }
  }
  return true;
};