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

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

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

Metric.key介绍

暂无

代码示例

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

@Nullable
 @Override
 public String apply(@Nonnull Metric input) {
  return input.key();
 }
}

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

@Nullable
 @Override
 public String apply(@Nonnull org.sonar.api.measures.Metric input) {
  return input.key();
 }
}

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

public DefaultMetricFinder(MetricsRepository metricsRepository) {
 Map<String, Metric<Serializable>> metrics = new LinkedHashMap<>();
 for (org.sonar.api.measures.Metric metric : metricsRepository.metrics()) {
  metrics.put(metric.key(), new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), metric.getType()).create());
 }
 metricsByKey = Collections.unmodifiableMap(metrics);
}

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

public <G extends Serializable> Measure<G> measure(String componentKey, Metric<G> metric) {
 return measure(componentKey, metric.key());
}

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

@Nullable
 @Override
 public String apply(@Nonnull Metric input) {
  return input.key();
 }
}

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

@Nullable
 @Override
 public String apply(@Nonnull org.sonar.api.measures.Metric input) {
  return input.key();
 }
}

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

public <G extends Serializable> Measure<G> measure(String componetKey, Metric<G> metric) {
 return measure(componetKey, metric.key());
}

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

public <G extends Serializable> Measure<G> measure(String componentKey, Metric<G> metric) {
 return measure(componentKey, metric.key());
}

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

public DefaultMetricFinder(MetricsRepository metricsRepository) {
 Map<String, Metric<Serializable>> metrics = new LinkedHashMap<>();
 for (org.sonar.api.measures.Metric metric : metricsRepository.metrics()) {
  metrics.put(metric.key(), new org.sonar.api.measures.Metric.Builder(metric.key(), metric.key(), metric.getType()).create());
 }
 metricsByKey = Collections.unmodifiableMap(metrics);
}

代码示例来源:origin: SonarSource/sonar-custom-plugin-example

@Override
 public void compute(MeasureComputerContext context) {
  Measure size = context.getMeasure(FILENAME_SIZE.key());
  if (size != null) {
   // rating values are currently implemented as integers in API
   int rating = RATING_A;
   if (size.getIntValue() > THRESHOLD) {
    rating = RATING_B;
   }
   context.addMeasure(FILENAME_SIZE_RATING.key(), rating);
  }
 }
}

代码示例来源:origin: SonarSource/sonar-custom-plugin-example

@Override
public MeasureComputerDefinition define(MeasureComputerDefinitionContext def) {
 return def.newDefinitionBuilder()
  .setInputMetrics(FILENAME_SIZE.key())
  .setOutputMetrics(FILENAME_SIZE_RATING.key())
  .build();
}

代码示例来源:origin: SonarSource/sonar-custom-plugin-example

@Override
 public void compute(MeasureComputerContext context) {
  // measure is already defined on files by {@link SetSizeOnFilesSensor}
  // in scanner stack
  if (context.getComponent().getType() != Component.Type.FILE) {
   int sum = 0;
   int count = 0;
   for (Measure child : context.getChildrenMeasures(FILENAME_SIZE.key())) {
    sum += child.getIntValue();
    count++;
   }
   int average = count == 0 ? 0 : sum / count;
   context.addMeasure(FILENAME_SIZE.key(), average);
  }
 }
}

代码示例来源:origin: SonarSource/sonar-custom-plugin-example

@Override
public MeasureComputerDefinition define(MeasureComputerDefinitionContext def) {
 return def.newDefinitionBuilder()
  .setOutputMetrics(FILENAME_SIZE.key())
  .build();
}

代码示例来源: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;
 }
}

相关文章