Search in sources :

Example 1 with ConditionEvaluator

use of org.sonar.server.computation.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 : PERIOD_ORDERING.immutableSortedCopy(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.server.computation.task.projectanalysis.measure.qualitygatedetails.EvaluatedCondition) Condition(org.sonar.server.computation.task.projectanalysis.qualitygate.Condition) ConditionEvaluator(org.sonar.server.computation.task.projectanalysis.qualitygate.ConditionEvaluator) EvaluationResult(org.sonar.server.computation.task.projectanalysis.qualitygate.EvaluationResult)

Aggregations

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