Skip to content

Commit

Permalink
count duplicate checks only once, closes HaxeCheckstyle#275
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed May 28, 2016
1 parent e48a205 commit 1a0a3e0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/checkstyle/Main.hx
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,21 @@ class Main {
return count;
}

function getUsedCheckCount():Int {
var count = 0;
var list:Array<String> = [];
for (check in checker.checks) {
var name = Type.getClassName(Type.getClass(check));
if (list.indexOf(name) >= 0) continue;
list.push(name);
count++;
}
return count;
}

function createReporter(numFiles:Int):IReporter {
var totalChecks = getCheckCount();
var checksUsed = checker.checks.length;
var checksUsed = getUsedCheckCount();
return switch (REPORT_TYPE) {
case "xml": new XMLReporter(numFiles, totalChecks, checksUsed, XML_PATH, STYLE, NO_STYLE);
case "json": new JSONReporter(numFiles, totalChecks, checksUsed, JSON_PATH, NO_STYLE);
Expand Down

0 comments on commit 1a0a3e0

Please sign in to comment.