se.vandmo.textchecker.maven.Checker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of text-checker-maven-plugin Show documentation
Show all versions of text-checker-maven-plugin Show documentation
Maven plugin that checks that text files adheres to certain rules.
package se.vandmo.textchecker.maven;
import static com.google.common.collect.Lists.newArrayList;
import static se.vandmo.textchecker.maven.Content.contentFromFile;
import java.io.File;
import java.util.Collection;
import java.util.List;
public final class Checker {
private final RulesResolver rulesResolver;
public Checker(RulesResolver rulesResolver) {
this.rulesResolver = rulesResolver;
}
public Collection getComplaintsFor(File file) throws Exception {
List complaints = newArrayList();
Content content = contentFromFile(file);
for (Rule rule : rulesResolver.getRulesFor(file)) {
Collection complaintsFromRule = rule.check(content);
if (complaintsFromRule != null) {
complaints.addAll(complaintsFromRule);
}
}
return complaints;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy