org.sonar.api.measures.Metric.getDescription()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(177)

本文整理了Java中org.sonar.api.measures.Metric.getDescription()方法的一些代码示例,展示了Metric.getDescription()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Metric.getDescription()方法的具体详情如下:
包路径:org.sonar.api.measures.Metric
类名称:Metric
方法名:getDescription

Metric.getDescription介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Test
public void shouldCreateMetricWithDefaultValues() {
 Metric metric = new Metric.Builder("foo", "Foo", Metric.ValueType.INT)
  .create();
 assertThat(metric.getBestValue()).isNull();
 assertThat(metric.getDescription()).isNull();
 assertThat(metric.getWorstValue()).isNull();
 assertThat(metric.getDirection()).isEqualTo(Metric.DIRECTION_NONE);
 assertThat(metric.getEnabled()).isTrue();
 assertThat(metric.getId()).isNull();
 assertThat(metric.getUserManaged()).isFalse();
 assertThat(metric.isHidden()).isFalse();
 assertThat(metric.isOptimizedBestValue()).isFalse();
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void all_core_metrics_are_in_core_bundle() {
 List<Metric> coreMetrics = CoreMetrics.getMetrics();
 List<String> incorrectMetricDefinitions = new ArrayList<>();
 for (Metric metric : coreMetrics) {
  if (metric.isHidden()) {
   continue;
  }
  String metricNamePropertyKey = "metric." + metric.getKey() + ".name";
  String l10nMetricName = underTest.message(Locale.ENGLISH, metricNamePropertyKey, null);
  if (l10nMetricName == null) {
   incorrectMetricDefinitions.add(metricNamePropertyKey + "=" + metric.getName());
  } else if (!l10nMetricName.equals(metric.getName())) {
   incorrectMetricDefinitions.add(metricNamePropertyKey + " is not consistent in core bundle and CoreMetrics");
  }
  String metricDescriptionPropertyKey = "metric." + metric.getKey() + ".description";
  String l10nMetricDescription = underTest.message(Locale.ENGLISH, metricDescriptionPropertyKey, null);
  if (l10nMetricDescription == null) {
   incorrectMetricDefinitions.add(metricDescriptionPropertyKey + "=" + metric.getDescription());
  } else if (!l10nMetricDescription.equals(metric.getDescription())) {
   incorrectMetricDefinitions.add(metricDescriptionPropertyKey + " is not consistent in core bundle and CoreMetrics");
  }
 }
 assertThat(incorrectMetricDefinitions).as("Metric definitions to fix in core bundle", incorrectMetricDefinitions.size()).isEmpty();
}

代码示例来源:origin: SonarSource/sonarqube

@Override
 @Nonnull
 public MetricDto apply(@Nonnull Metric metric) {
  MetricDto dto = new MetricDto();
  dto.setId(metric.getId());
  dto.setKey(metric.getKey());
  dto.setDescription(metric.getDescription());
  dto.setShortName(metric.getName());
  dto.setBestValue(metric.getBestValue());
  dto.setDomain(metric.getDomain());
  dto.setEnabled(metric.getEnabled());
  dto.setDirection(metric.getDirection());
  dto.setHidden(metric.isHidden());
  dto.setQualitative(metric.getQualitative());
  dto.setValueType(metric.getType().name());
  dto.setOptimizedBestValue(metric.isOptimizedBestValue());
  dto.setUserManaged(metric.getUserManaged());
  dto.setWorstValue(metric.getWorstValue());
  dto.setDeleteHistoricalData(metric.getDeleteHistoricalData());
  dto.setDecimalScale(metric.getDecimalScale());
  return dto;
 }
}

代码示例来源:origin: org.codehaus.sonar/sonar-batch

public FakeGlobalRepositoriesLoader add(Metric metric) {
  Boolean optimizedBestValue = metric.isOptimizedBestValue();
  ref.metrics().add(new org.sonar.batch.protocol.input.Metric(metricId,
   metric.key(),
   metric.getType().name(),
   metric.getDescription(),
   metric.getDirection(),
   metric.getName(),
   metric.getQualitative(),
   metric.getUserManaged(),
   metric.getWorstValue(),
   metric.getBestValue(),
   optimizedBestValue != null ? optimizedBestValue : false));
  metricId++;
  return this;
 }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-server

@Override
 @Nonnull
 public MetricDto apply(@Nonnull Metric metric) {
  MetricDto dto = new MetricDto();
  dto.setId(metric.getId());
  dto.setKey(metric.getKey());
  dto.setDescription(metric.getDescription());
  dto.setShortName(metric.getName());
  dto.setBestValue(metric.getBestValue());
  dto.setDomain(metric.getDomain());
  dto.setEnabled(metric.getEnabled());
  dto.setDirection(metric.getDirection());
  dto.setHidden(metric.isHidden());
  dto.setQualitative(metric.getQualitative());
  dto.setValueType(metric.getType().name());
  dto.setOptimizedBestValue(metric.isOptimizedBestValue());
  dto.setUserManaged(metric.getUserManaged());
  dto.setWorstValue(metric.getWorstValue());
  dto.setDeleteHistoricalData(metric.getDeleteHistoricalData());
  dto.setDecimalScale(metric.getDecimalScale());
  return dto;
 }
}

相关文章