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

edu.hm.hafner.analysis.parser.pmd.Pmd Maven / Gradle / Ivy

Go to download

This library provides a Java object model to read, aggregate, filter, and query static analysis reports. It is used by Jenkins' warnings next generation plug-in to visualize the warnings of individual builds. Additionally, this library is used by a GitHub action to autograde student software projects based on a given set of metrics (unit tests, code and mutation coverage, static analysis warnings).

There is a newer version: 13.3.0
Show newest version
package edu.hm.hafner.analysis.parser.pmd;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

/**
 * Java Bean class for warnings of the PMD format.
 *
 * @author Ullrich Hafner
 */
public class Pmd {
    private final List files = new ArrayList<>();
    private final List errors = new ArrayList<>();

    /**
     * Adds a new file.
     *
     * @param file
     *         the file to add
     */
    public void addFile(final File file) {
        files.add(file);
    }

    /**
     * Adds a new error.
     *
     * @param error
     *         the error to add
     */
    public void addError(final PmdError error) {
        errors.add(error);
    }

    /**
     * Returns all files. The returned collection is read-only.
     *
     * @return all files
     */
    public Collection getFiles() {
        return Collections.unmodifiableCollection(files);
    }

    /**
     * Returns all errors. The returned collection is read-only.
     *
     * @return all errors
     */
    public Collection getErrors() {
        return Collections.unmodifiableCollection(errors);
    }
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy