Examples of RuleKey


Examples of org.sonar.api.rule.RuleKey

    assertThat(key.toString()).isEqualTo("P1:xoo:R1");
  }

  @Test
  public void rule_key_can_contain_colons() throws Exception {
    RuleKey ruleKey = RuleKey.of("squid", "Key:With:Some::Colons");
    ActiveRuleKey key = ActiveRuleKey.of("P1", ruleKey);
    assertThat(key.qProfile()).isEqualTo("P1");
    assertThat(key.ruleKey()).isSameAs(ruleKey);
    assertThat(key.toString()).isEqualTo("P1:squid:Key:With:Some::Colons");
  }
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

    NewRule customRule = NewRule.createForCustomRule("MY_CUSTOM", templateRule.getKey())
      .setName("My custom")
      .setSeverity(Severity.MINOR)
      .setStatus(RuleStatus.READY)
      .setMarkdownDescription("<div>line1\nline2</div>");
    RuleKey customRuleKey = ruleService.create(customRule);
    session.clearCache();

    WsTester.TestRequest request = wsTester.newGetRequest("api/rules", "show")
      .setParam("key", customRuleKey.toString());
    request.execute().assertJson(getClass(), "encode_html_description_of_custom_rule.json", false);
  }
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

    // Manual rule
    NewRule manualRule = NewRule.createForManualRule("MY_MANUAL")
      .setName("My manual")
      .setSeverity(Severity.MINOR)
      .setMarkdownDescription("<div>line1\nline2</div>");
    RuleKey customRuleKey = ruleService.create(manualRule);
    session.clearCache();

    WsTester.TestRequest request = wsTester.newGetRequest("api/rules", "show")
      .setParam("key", customRuleKey.toString());
    request.execute().assertJson(getClass(), "encode_html_description_of_manual_rule.json", false);
  }
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

      }
    });
    Rule template = ruleIndex.getByKey(RuleKey.of("xoo", "T1"));

    // Create custom rule
    RuleKey customRuleKey = TESTER.get(RuleCreator.class).create(NewRule.createForCustomRule("CUSTOM_RULE", template.key())
      .setName("My custom")
      .setHtmlDescription("Some description")
      .setSeverity(Severity.MAJOR)
      .setStatus(RuleStatus.READY)
      .setParameters(ImmutableMap.of("format", "txt")));
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

    };
    register(rules);
    Rule template = ruleIndex.getByKey(RuleKey.of("xoo", "T1"));

    // Create custom rule
    RuleKey customRuleKey = TESTER.get(RuleCreator.class).create(NewRule.createForCustomRule("CUSTOM_RULE", template.key())
      .setName("My custom")
      .setHtmlDescription("Some description")
      .setSeverity(Severity.MAJOR)
      .setStatus(RuleStatus.READY)
      .setParameters(ImmutableMap.of("format", "txt")));
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

      }
    });
    Rule templateRule = ruleIndex.getByKey(RuleKey.of("xoo", "T1"));

    // Create custom rule
    RuleKey customRuleKey = TESTER.get(RuleCreator.class).create(NewRule.createForCustomRule("CUSTOM_RULE", templateRule.key())
      .setName("My custom")
      .setHtmlDescription("Some description")
      .setSeverity(Severity.MAJOR)
      .setStatus(RuleStatus.READY)
      .setParameters(ImmutableMap.of("format", "txt")));
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

    };
    register(rules);
    Rule templateRule = ruleIndex.getByKey(RuleKey.of("xoo", "T1"));

    // Create custom rule
    RuleKey customRuleKey = TESTER.get(RuleCreator.class).create(NewRule.createForCustomRule("CUSTOM_RULE", templateRule.key())
      .setName("My custom")
      .setHtmlDescription("Some description")
      .setSeverity(Severity.MAJOR)
      .setStatus(RuleStatus.READY)
      .setParameters(ImmutableMap.of("format", "txt")));
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

  }

  @Test
  public void do_not_disable_manual_rules() {
    // Create manual rule
    RuleKey manualRuleKey = TESTER.get(RuleCreator.class).create(NewRule.createForManualRule("MANUAL_RULE")
      .setName("My manual")
      .setHtmlDescription("Some description"));
    dbSession.commit();
    dbSession.clearCache();
    assertThat(ruleIndex.getByKey(manualRuleKey).status()).isEqualTo(RuleStatus.READY);
View Full Code Here

Examples of org.sonar.api.rule.RuleKey

    Metric metric = SeverityUtils.severityToIssueMetric(severity);

    Collection<Measure> children = context.getChildrenMeasures(MeasuresFilters.rules(metric));
    for (Measure child : children) {
      RuleMeasure childRuleMeasure = (RuleMeasure) child;
      RuleKey ruleKey = childRuleMeasure.ruleKey();
      if (ruleKey != null && MeasureUtils.hasValue(childRuleMeasure)) {
        Multiset<RuleKey> rulesBag = initRules(rulesPerSeverity, severity);
        rulesBag.add(ruleKey, childRuleMeasure.getIntValue());
      }
    }
View Full Code Here

Examples of org.sonar.api.rule.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
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.