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

edu.hm.hafner.analysis.ModuleResolver 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;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Resolves module names by reading and mapping module definitions (build.xml, pom.xml, or Manifest.mf files).
 *
 * @author Ullrich Hafner
 */
public class ModuleResolver {
    /**
     * Resolves absolute paths of the affected files of the specified set of issues.
     *
     * @param report
     *         the issues to resolve the paths
     * @param detector
     *         the module detector to use
     */
    public void run(final Report report, final ModuleDetector detector) {
        List issuesWithoutModule = report.stream()
                .filter(issue -> !issue.hasModuleName())
                .collect(Collectors.toList());

        if (issuesWithoutModule.isEmpty()) {
            report.logInfo("-> all issues already have a valid module name");

            return;
        }

        issuesWithoutModule.forEach(issue -> issue.setModuleName(detector.guessModuleName(issue.getAbsolutePath())));
        report.logInfo("-> resolved module names for %d issues", issuesWithoutModule.size());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy