se.bjurr.violations.lib.ViolationsApi Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of violations-lib Show documentation
Show all versions of violations-lib Show documentation
Library for parsing report files from static code analyzis.
package se.bjurr.violations.lib;
import static se.bjurr.violations.lib.reports.ReportsFinder.findAllReports;
import java.io.File;
import java.util.List;
import se.bjurr.violations.lib.model.Violation;
import se.bjurr.violations.lib.reports.Reporter;
public class ViolationsApi {
private String pattern;
private Reporter reporter;
private File startFile;
private ViolationsApi() {
}
public static ViolationsApi violationsApi() {
return new ViolationsApi();
}
public ViolationsApi withPattern(String regularExpression) {
this.pattern = regularExpression;
return this;
}
public ViolationsApi findAll(Reporter reporter) {
this.reporter = reporter;
return this;
}
public ViolationsApi inFolder(String folder) {
this.startFile = new File(folder);
if (!startFile.exists()) {
throw new RuntimeException(folder + " not found");
}
return this;
}
public List violations() {
List includedFiles = findAllReports(startFile, pattern);
return reporter.findViolations(includedFiles);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy