All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cflint.BugCounts Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.5.0
Show newest version

package com.cflint;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class BugCounts {
    protected Map severityCounts = new HashMap<>();
    protected Map codeCounts = new HashMap<>();
    protected int noBugs = 0;

    public void add(final String code, final Levels severity) {
        if (severity == Levels.UNKNOWN) {
            return;
        }

        if (codeCounts.get(code) == null) {
            codeCounts.put(code, 1);
        } else {
            codeCounts.put(code, codeCounts.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 codeCounts.size();
    }

    public Set bugTypes() {
        return codeCounts.keySet();
    }

    public int getCode(final String code) {
        if (codeCounts.get(code) != null) {
            return codeCounts.get(code);
        }

        return 0;
    }

    public int getSeverity(final Levels severity) {
        if (severityCounts.get(severity) != null) {
            return severityCounts.get(severity);
        }

        return 0;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy