Package org.sonar.api.measures

Examples of org.sonar.api.measures.CountDistributionBuilder


    return CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION;
  }

  @Override
  public void decorate(Resource resource, DecoratorContext context) {
    CountDistributionBuilder nclocDistribution = new CountDistributionBuilder(CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION);
    if (ResourceUtils.isFile(resource)) {
      Language language = resource.getLanguage();
      Measure ncloc = context.getMeasure(CoreMetrics.NCLOC);
      if (language != null && ncloc != null) {
        nclocDistribution.add(language.getKey(), ncloc.getIntValue());
      }
    } else {
      for (Measure measure : context.getChildrenMeasures(CoreMetrics.NCLOC_LANGUAGE_DISTRIBUTION)) {
        nclocDistribution.add(measure);
      }
    }
    Measure measure = nclocDistribution.build(false);
    if (measure != null) {
      context.saveMeasure(measure);
    }
  }
View Full Code Here

TOP

Related Classes of org.sonar.api.measures.CountDistributionBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.