de.obqo.decycle.maven.DecycleCheckMojo Maven / Gradle / Ivy
package de.obqo.decycle.maven;
import de.obqo.decycle.check.Constraint;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
/**
* Maven goal for performing decycle checks on the compiled classes (and test classes) of a project.
* Intended to run automatically in the verify phase with
* <executions><execution><goals><goal>check</goal></goals></execution></executions>
* More info: https://github.com/obecker/decycle
*/
@Mojo(name = "check", defaultPhase = LifecyclePhase.VERIFY, threadSafe = true)
public class DecycleCheckMojo extends AbstractDecycleMojo {
@Override
protected List executeCheck() throws IOException {
final List mainViolations = checkMain();
final List testViolations = checkTest();
return Stream.of(mainViolations, testViolations).flatMap(Collection::stream).collect(Collectors.toList());
}
}