Search in sources :

Example 1 with Metric

use of org.sonar.ce.task.projectanalysis.metric.Metric in project sonarqube by SonarSource.

the class MeasureComputerContextImpl method addMeasure.

@Override
public void addMeasure(String metricKey, boolean value) {
    Metric metric = metricRepository.getByKey(metricKey);
    validateAddMeasure(metric);
    measureRepository.add(internalComponent, metric, newMeasureBuilder().create(value));
}
Also used : Metric(org.sonar.ce.task.projectanalysis.metric.Metric)

Example 2 with Metric

use of org.sonar.ce.task.projectanalysis.metric.Metric in project sonarqube by SonarSource.

the class MeasureComputerContextImpl method addMeasure.

@Override
public void addMeasure(String metricKey, String value) {
    Metric metric = metricRepository.getByKey(metricKey);
    validateAddMeasure(metric);
    measureRepository.add(internalComponent, metric, newMeasureBuilder().create(value));
}
Also used : Metric(org.sonar.ce.task.projectanalysis.metric.Metric)

Example 3 with Metric

use of org.sonar.ce.task.projectanalysis.metric.Metric in project sonarqube by SonarSource.

the class MeasureComputerContextImpl method addMeasure.

@Override
public void addMeasure(String metricKey, double value) {
    Metric metric = metricRepository.getByKey(metricKey);
    validateAddMeasure(metric);
    measureRepository.add(internalComponent, metric, newMeasureBuilder().create(value, metric.getDecimalScale()));
}
Also used : Metric(org.sonar.ce.task.projectanalysis.metric.Metric)

Example 4 with Metric

use of org.sonar.ce.task.projectanalysis.metric.Metric in project sonarqube by SonarSource.

the class MeasureComputerContextImpl method addMeasure.

@Override
public void addMeasure(String metricKey, int value) {
    Metric metric = metricRepository.getByKey(metricKey);
    validateAddMeasure(metric);
    measureRepository.add(internalComponent, metric, newMeasureBuilder().create(value));
}
Also used : Metric(org.sonar.ce.task.projectanalysis.metric.Metric)

Example 5 with Metric

use of org.sonar.ce.task.projectanalysis.metric.Metric in project sonarqube by SonarSource.

the class MeasureComputerContextImpl method addMeasure.

@Override
public void addMeasure(String metricKey, long value) {
    Metric metric = metricRepository.getByKey(metricKey);
    validateAddMeasure(metric);
    measureRepository.add(internalComponent, metric, newMeasureBuilder().create(value));
}
Also used : Metric(org.sonar.ce.task.projectanalysis.metric.Metric)

Aggregations

Metric (org.sonar.ce.task.projectanalysis.metric.Metric)35 Test (org.junit.Test)16 Measure (org.sonar.ce.task.projectanalysis.measure.Measure)15 UseDataProvider (com.tngtech.java.junit.dataprovider.UseDataProvider)5 MetricImpl (org.sonar.ce.task.projectanalysis.metric.MetricImpl)5 Condition (org.sonar.ce.task.projectanalysis.qualitygate.Condition)4 ImmutableMap (com.google.common.collect.ImmutableMap)2 Map (java.util.Map)2 QualityGateStatus (org.sonar.ce.task.projectanalysis.measure.QualityGateStatus)2 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 RuleType (org.sonar.api.rules.RuleType)1 Branch (org.sonar.ce.task.projectanalysis.analysis.Branch)1 Component (org.sonar.ce.task.projectanalysis.component.Component)1 EvaluatedCondition (org.sonar.ce.task.projectanalysis.measure.qualitygatedetails.EvaluatedCondition)1 QualityGateDetailsData (org.sonar.ce.task.projectanalysis.measure.qualitygatedetails.QualityGateDetailsData)1 MetricType (org.sonar.ce.task.projectanalysis.metric.Metric.MetricType)1 EvaluationResult (org.sonar.ce.task.projectanalysis.qualitygate.EvaluationResult)1 QualityGate (org.sonar.ce.task.projectanalysis.qualitygate.QualityGate)1 TestComputationStepContext (org.sonar.ce.task.step.TestComputationStepContext)1