class PmdValidator implements ResourceValidator {

    @Override
    @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
    public Collection<Violation> validate(final Collection<File> files) {
        final SourceValidator validator = new SourceValidator(this.env);
        final Collection<DataSource> sources = new LinkedList<>();
        for (final File file : files) {
            sources.add(new FileDataSource(file));
        }
        final Collection<RuleViolation> breaches = validator.validate(
            sources, this.env.basedir().getPath()
        );
        final Collection<Violation> violations = new LinkedList<>();
        for (final RuleViolation breach : breaches) {
            violations.add(
                new Violation.Default(
                    this.name(),
                    breach.getRule().getName(),
                    breach.getFilename(),
                    String.format(
                        "%d-%d",
                        breach.getBeginLine(), breach.getEndLine()
                    ),
                    breach.getDescription()
                )
            );
        }
        return violations;
    }

    public  PmdValidator(final Environment env);

}