Examples of ruleKey()


Examples of org.sonar.api.measures.RuleMeasure.ruleKey()

      Set<RuleKey> ruleKeys = Sets.newHashSet();

      Collection<Measure> children = context.getChildrenMeasures(MeasuresFilters.rules(metric));
      for (Measure child : children) {
        RuleMeasure childRuleMeasure = (RuleMeasure) child;
        RuleKey ruleKey = childRuleMeasure.ruleKey();
        if (ruleKey != null) {
          childMeasuresPerRuleKeys.put(ruleKey, childRuleMeasure);
          ruleKeys.add(ruleKey);
        }
      }
View Full Code Here

Examples of org.sonar.api.measures.RuleMeasure.ruleKey()

    // Aggregate rules debt from children (and populate children characteristics debt)
    for (Measure measure : context.getChildrenMeasures(MeasuresFilters.rules(CoreMetrics.TECHNICAL_DEBT))) {
      Long debt = measure.getValue().longValue();
      RuleMeasure ruleMeasure = (RuleMeasure) measure;
      total += computeDebt(debt, ruleMeasure.ruleKey(), ruleDebts, characteristicDebts);
    }

    context.saveMeasure(CoreMetrics.TECHNICAL_DEBT, total.doubleValue());
    saveOnRule(context, ruleDebts);
    for (Characteristic characteristic : model.characteristics()) {
View Full Code Here

Examples of org.sonar.api.measures.RuleMeasure.ruleKey()

      if (!(o instanceof RuleMeasure)) {
        return false;
      }
      RuleMeasure m = (RuleMeasure) o;
      return ObjectUtils.equals(metric, m.getMetric()) &&
        ObjectUtils.equals(rule.ruleKey(), m.ruleKey()) &&
        ObjectUtils.equals(var1, m.getVariation1()) &&
        ObjectUtils.equals(var2, m.getVariation2());
    }
  }
View Full Code Here

Examples of org.sonar.api.measures.RuleMeasure.ruleKey()

    if (!(o instanceof RuleMeasure)) {
      return false;
    }
    RuleMeasure m = (RuleMeasure) o;
    return ObjectUtils.equals(metric, m.getMetric()) &&
      ObjectUtils.equals(rule.ruleKey(), m.ruleKey()) &&
      NumberUtils.compare(value, m.getValue()) == 0;
  }
}
View Full Code Here

Examples of org.sonar.api.measures.RuleMeasure.ruleKey()

    model.setPersonId(measure.getPersonId());
    model.setValue(measure.getValue());
    if (measure instanceof RuleMeasure) {
      RuleMeasure ruleMeasure = (RuleMeasure) measure;
      model.setRulePriority(ruleMeasure.getSeverity());
      RuleKey ruleKey = ruleMeasure.ruleKey();
      if (ruleKey != null) {
        Rule ruleWithId = ruleFinder.findByKey(ruleKey);
        if (ruleWithId == null) {
          throw new IllegalStateException("Can not save a measure with unknown rule " + ruleMeasure);
        }
View Full Code Here

Examples of org.sonar.api.measures.RuleMeasure.ruleKey()

      if (!(o instanceof RuleMeasure)) {
        return false;
      }
      RuleMeasure m = (RuleMeasure) o;
      return ObjectUtils.equals(metric, m.getMetric()) &&
        ObjectUtils.equals(ruleKey, m.ruleKey()) &&
        ObjectUtils.equals(value, m.getValue());
    }

    @Override
    public void describeTo(Description description) {
View Full Code Here

Examples of org.sonar.api.rules.Rule.ruleKey()

    rule1.setId(1);
    Rule rule2 = Rule.create("repo", "rule2");
    rule2.setId(2);

    when(ruleFinder.findByKey(rule1.ruleKey())).thenReturn(rule1);
    when(ruleFinder.findByKey(rule2.ruleKey())).thenReturn(rule2);

    Resource dir = new Directory("org/foo");

    PastMeasuresLoader pastMeasuresLoader = mock(PastMeasuresLoader.class);
    PastSnapshot pastSnapshot1 = new PastSnapshot("days", new Date()).setIndex(1);
View Full Code Here

Examples of org.sonar.api.rules.Rule.ruleKey()

  @Test
  public void should_insert_rule_measure() {
    setupData("empty");

    Rule rule = Rule.create("pmd", "key");
    when(ruleFinder.findByKey(rule.ruleKey())).thenReturn(rule);

    Measure measure = new RuleMeasure(ncloc(), rule, RulePriority.MAJOR, 1).setValue(1234.0);
    when(measureCache.entries()).thenReturn(Arrays.asList(new Cache.Entry<Measure>(new String[] {"foo", "ncloc"}, measure)));

    measurePersister.persist();
View Full Code Here

Examples of org.sonar.core.qualityprofile.db.ActiveRuleKey.ruleKey()

    ActiveRuleKey key = activeRuleDto.getKey();
    Preconditions.checkArgument(key != null, "Cannot normalize ActiveRuleDto with null key");

    Map<String, Object> newRule = new HashMap<String, Object>();
    newRule.put("_parent", key.ruleKey().toString());
    newRule.put(ActiveRuleField.RULE_KEY.field(), key.ruleKey().toString());
    newRule.put(ActiveRuleField.KEY.field(), key.toString());
    newRule.put(ActiveRuleField.INHERITANCE.field(),
      (activeRuleDto.getInheritance() != null) ?
        activeRuleDto.getInheritance() :
View Full Code Here

Examples of org.sonar.core.qualityprofile.db.ActiveRuleKey.ruleKey()

    ActiveRuleKey key = activeRuleDto.getKey();
    Preconditions.checkArgument(key != null, "Cannot normalize ActiveRuleDto with null key");

    Map<String, Object> newRule = new HashMap<String, Object>();
    newRule.put("_parent", key.ruleKey().toString());
    newRule.put(ActiveRuleField.RULE_KEY.field(), key.ruleKey().toString());
    newRule.put(ActiveRuleField.KEY.field(), key.toString());
    newRule.put(ActiveRuleField.INHERITANCE.field(),
      (activeRuleDto.getInheritance() != null) ?
        activeRuleDto.getInheritance() :
        ActiveRule.Inheritance.NONE.name());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.