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

se.vandmo.textchecker.maven.Checker Maven / Gradle / Ivy

There is a newer version: 0.22.1
Show newest version
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