com.cflint.BugCounts Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of CFLint Show documentation
Show all versions of CFLint Show documentation
A static code analysis tool for ColdFusion (in the spirit of FindBugs and Lint). With CFLint, you are able to analyze your ColdFusion code base for code violations.
package com.cflint;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class BugCounts {
final public static String[] levels = new String[] { "FATAL", "CRITICAL", "ERROR", "WARNING", "CAUTION", "INFO",
"COSMETIC" };
protected Map severityCounts = new HashMap();
protected Map bugCounts = new HashMap();
protected int noBugs = 0;
public void add(final String code, final String severity) {
if (bugCounts.get(code) == null) {
bugCounts.put(code, 1);
} else {
bugCounts.put(code, bugCounts.get(code) + 1);
}
if (severityCounts.get(severity) == null) {
severityCounts.put(severity, 1);
} else {
severityCounts.put(severity, severityCounts.get(severity) + 1);
}
noBugs++;
}
public int noBugs() {
return noBugs;
}
public int noBugTypes() {
return bugCounts.size();
}
public Set bugTypes() {
return bugCounts.keySet();
}
public int getCode(final String code) {
if (bugCounts.get(code) != null) {
return bugCounts.get(code);
}
return 0;
}
public int getSeverity(final String severity) {
if (severityCounts.get(severity) != null) {
return severityCounts.get(severity);
}
return 0;
}
}