Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
Add Good Parts™ options, remove useless details.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlekSi committed Feb 28, 2010
1 parent e422456 commit 5d51449
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
11 changes: 3 additions & 8 deletions main.cpp
Expand Up @@ -7,6 +7,8 @@ const int MISSING_FILE = 2;
const int PARSE_ERROR = 3;
const int LINT_ERROR = 4;

const QString goodPartsOptions("{ white: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, strict: true, newcap: true, immed: true }");

void out(const QString& message) { std::fprintf(stdout, "%s\n", qPrintable(message)); }
void err(const QString& message) { std::fprintf(stderr, "%s\n", qPrintable(message)); }

Expand Down Expand Up @@ -51,7 +53,7 @@ int main(int argc, char *argv[])
inputData = "[ '" + inputData.replace("\n", "', '") + "' ]";

// run jslint
const QString cmd = QString("JSLINT(%1)").arg(inputData);
const QString cmd = QString("JSLINT(%1, %2)").arg(inputData).arg(goodPartsOptions);
const QScriptValue res = engine.evaluate(cmd);
if (engine.hasUncaughtException()) {
err("Uncaught exception at parsing " + inputFileName);
Expand All @@ -77,13 +79,6 @@ int main(int argc, char *argv[])

out(QString("%1) Problem at line %2 character %3: '%4'").arg(it.name().toInt() + 1).arg(line).arg(character).arg(evidence));
out("\t" + reason);
static QStringList detailsProps(QString("a b c d").split(" "));
foreach(const QString& detailsProp, detailsProps) {
const QScriptValue detail = error.property(detailsProp);
if (!detail.isUndefined()) {
out("\t" + detail.toString());
}
}
}

// generate report
Expand Down
1 change: 1 addition & 0 deletions qtslint.pro
Expand Up @@ -6,3 +6,4 @@ CONFIG += console
CONFIG -= app_bundle

SOURCES += main.cpp
OTHER_FILES = fulljslint.js

0 comments on commit 5d51449

Please sign in to comment.