edu.hm.hafner.analysis.AbstractModuleDetector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of analysis-model Show documentation
Show all versions of analysis-model Show documentation
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).
package edu.hm.hafner.analysis;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import edu.hm.hafner.analysis.ModuleDetector.FileSystem;
/**
* Abstract class for all Module Detectors.
*/
abstract class AbstractModuleDetector {
static final String SLASH = "/";
static final String ALL_DIRECTORIES = "**/";
static final String PLUS = ", ";
private final FileSystem factory;
/**
* Collects all projects of a specific type.
* @param mapping the mapping of path prefixes to module names
* @param projects the projects of a specific type
*/
abstract void collectProjects(Map mapping, List projects);
/**
* Returns the names of all project files in the following structure:
* {@code **\/build.xml}.
*
* @return pattern
*/
abstract String getPattern();
AbstractModuleDetector(final FileSystem fileSystem) {
factory = fileSystem;
}
void addMapping(final Map mapping, final String fileName, final String suffix,
final String moduleName) {
if (StringUtils.isNotBlank(moduleName)) {
mapping.put(StringUtils.substringBeforeLast(fileName, suffix), moduleName);
}
}
public FileSystem getFactory() {
return factory;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy