use of com.buschmais.jqassistant.core.rule.api.model.RuleSelection in project jqa-maven-plugin by jQAssistant.
the class EffectiveRulesMojo method aggregate.
@Override
public void aggregate(MavenProject rootModule, List<MavenProject> projects, Store store) throws MojoExecutionException, MojoFailureException {
getLog().info("Effective rules for '" + rootModule.getName() + "'.");
RuleSet ruleSet = readRules(rootModule);
RuleSelection ruleSelection = RuleSelection.select(ruleSet, groups, constraints, concepts);
RuleHelper ruleHelper = new RuleHelper(LOGGER);
try {
ruleHelper.printRuleSet(ruleSet, ruleSelection);
} catch (RuleException e) {
throw new MojoExecutionException("Cannot print effective rules.", e);
}
}
use of com.buschmais.jqassistant.core.rule.api.model.RuleSelection in project jqa-maven-plugin by jQAssistant.
the class AnalyzeMojo method aggregate.
@Override
public void aggregate(MojoExecutionContext mojoExecutionContext) throws MojoExecutionException, MojoFailureException {
MavenConfiguration configuration = mojoExecutionContext.getConfiguration();
MavenProject rootModule = mojoExecutionContext.getRootModule();
RuleSet ruleSet = readRules(mojoExecutionContext);
Analyze analyze = configuration.analyze();
RuleSelection ruleSelection = RuleSelection.select(ruleSet, analyze.groups(), analyze.constraints(), analyze.concepts());
File outputDirectory = mojoExecutionContext.getOutputDirectory();
withStore(store -> analyze(configuration, rootModule, ruleSet, ruleSelection, store, outputDirectory), mojoExecutionContext);
}
use of com.buschmais.jqassistant.core.rule.api.model.RuleSelection in project jqa-maven-plugin by jQAssistant.
the class EffectiveRulesMojo method aggregate.
@Override
public void aggregate(MojoExecutionContext mojoExecutionContext) throws MojoExecutionException, MojoFailureException {
getLog().info("Effective rules for '" + mojoExecutionContext.getRootModule().getName() + "'.");
Analyze analyze = mojoExecutionContext.getConfiguration().analyze();
RuleSet ruleSet = readRules(mojoExecutionContext);
RuleSelection ruleSelection = RuleSelection.select(ruleSet, analyze.groups(), analyze.constraints(), analyze.concepts());
RuleHelper ruleHelper = new RuleHelper(LOGGER);
try {
ruleHelper.printRuleSet(ruleSet, ruleSelection, analyze.rule());
} catch (RuleException e) {
throw new MojoExecutionException("Cannot print effective rules.", e);
}
}
use of com.buschmais.jqassistant.core.rule.api.model.RuleSelection in project jqa-maven-plugin by jQAssistant.
the class AnalyzeMojo method aggregate.
@Override
public void aggregate(MavenProject rootModule, List<MavenProject> projects, Store store) throws MojoExecutionException, MojoFailureException {
getLog().info("Executing analysis for '" + rootModule.getName() + "'.");
getLog().info("Will warn on violations starting from severity '" + warnOnSeverity + "'");
getLog().info("Will fail on violations starting from severity '" + failOnSeverity + "'.");
RuleSet ruleSet = readRules(rootModule);
RuleSelection ruleSelection = RuleSelection.select(ruleSet, groups, constraints, concepts);
ReportContext reportContext = new ReportContextImpl(store, ProjectResolver.getOutputDirectory(rootModule));
Severity effectiveFailOnSeverity = failOnSeverity;
Map<String, Object> properties = getReportProperties();
Map<String, ReportPlugin> reportPlugins = getPluginRepository().getAnalyzerPluginRepository().getReportPlugins(reportContext, properties);
InMemoryReportPlugin inMemoryReportPlugin = new InMemoryReportPlugin(new CompositeReportPlugin(reportPlugins, reportTypes.isEmpty() ? null : reportTypes));
AnalyzerConfiguration configuration = new AnalyzerConfiguration();
configuration.setExecuteAppliedConcepts(executeAppliedConcepts);
try {
Analyzer analyzer = new AnalyzerImpl(configuration, store, getPluginRepository().getAnalyzerPluginRepository().getRuleInterpreterPlugins(emptyMap()), inMemoryReportPlugin, logger);
analyzer.execute(ruleSet, ruleSelection, ruleParameters);
} catch (RuleException e) {
throw new MojoExecutionException("Analysis failed.", e);
}
if (attachReportArchive) {
attachReportArchive(rootModule, reportContext);
}
ReportHelper reportHelper = new ReportHelper(logger);
store.beginTransaction();
try {
verifyAnalysisResults(inMemoryReportPlugin, reportHelper, effectiveFailOnSeverity);
} finally {
store.commitTransaction();
}
}
Aggregations