Search in sources :

Example 1 with ConditionEvaluator

use of org.sonar.ce.task.projectanalysis.qualitygate.ConditionEvaluator in project sonarqube by SonarSource.

the class QualityGateMeasuresStep method evaluateQualityGate.

private static MetricEvaluationResult evaluateQualityGate(Measure measure, Collection<Condition> conditions) {
    ConditionEvaluator conditionEvaluator = new ConditionEvaluator();
    MetricEvaluationResult metricEvaluationResult = null;
    for (Condition newCondition : conditions) {
        EvaluationResult newEvaluationResult = conditionEvaluator.evaluate(newCondition, measure);
        if (metricEvaluationResult == null || newEvaluationResult.getLevel().ordinal() > metricEvaluationResult.evaluationResult.getLevel().ordinal()) {
            metricEvaluationResult = new MetricEvaluationResult(newEvaluationResult, newCondition);
        }
    }
    return metricEvaluationResult;
}
Also used : EvaluatedCondition(org.sonar.ce.task.projectanalysis.measure.qualitygatedetails.EvaluatedCondition) Condition(org.sonar.ce.task.projectanalysis.qualitygate.Condition) ConditionEvaluator(org.sonar.ce.task.projectanalysis.qualitygate.ConditionEvaluator) EvaluationResult(org.sonar.ce.task.projectanalysis.qualitygate.EvaluationResult)

Aggregations

EvaluatedCondition (org.sonar.ce.task.projectanalysis.measure.qualitygatedetails.EvaluatedCondition)1 Condition (org.sonar.ce.task.projectanalysis.qualitygate.Condition)1 ConditionEvaluator (org.sonar.ce.task.projectanalysis.qualitygate.ConditionEvaluator)1 EvaluationResult (org.sonar.ce.task.projectanalysis.qualitygate.EvaluationResult)1