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

com.lewisd.maven.lint.ResultCollectorImpl Maven / Gradle / Ivy

Go to download

Generates a report of suspicious/inconsistent POM elements, and optionally fails the build if violations are found.

The newest version!
package com.lewisd.maven.lint;

import org.apache.maven.model.InputLocation;
import org.apache.maven.project.MavenProject;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.LinkedList;
import java.util.List;

public class ResultCollectorImpl implements ResultCollector {

	private final List violations = new LinkedList();
	private final ViolationSuppressor violationSuppressor;

	@Autowired
	public ResultCollectorImpl(final ViolationSuppressor violationSuppressor) {
		this.violationSuppressor = violationSuppressor;
	}

	public void addViolation(final MavenProject mavenProject, final Rule rule, final String message, final InputLocation inputLocation) {
		Violation violation = new Violation(mavenProject, rule, message, inputLocation);
		if (!violationSuppressor.isSuppressed(violation)) {
			violations.add(violation);
		}
	}

	public boolean hasViolations() {
		return !violations.isEmpty();
	}

	public List getViolations() {
		return violations;
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy