コード例 #1
0
  @Test
  public void toModels() {
    Rule rule = new RuleUnmarshaller().toModel("[]");
    assertThat(rule, nullValue());

    List<Rule> rules = new RuleUnmarshaller().toModels("[]");
    assertThat(rules.size(), is(0));

    rules = new RuleUnmarshaller().toModels(loadFile("/rules/rules.json"));
    assertThat(rules.size(), is(6));

    rule = rules.get(0);
    assertThat(rule.getTitle(), is("Indentation"));
    assertThat(
        rule.getKey(),
        is("checkstyle:com.puppycrawl.tools.checkstyle.checks.indentation.IndentationCheck"));
    assertThat(rule.getRepository(), is("checkstyle"));
    assertThat(rule.getDescription(), is("Checks correct indentation of Java Code."));
    assertThat(rule.getSeverity(), is("MINOR"));
    assertThat(rule.isActive(), is(false));
    assertThat(rule.getParams().size(), is(3));
    assertThat(rule.getParams().get(0).getName(), is("basicOffset"));
    assertThat(
        rule.getParams().get(0).getDescription(),
        is("how many spaces to use for new indentation level. Default is 4."));

    rule = rules.get(1);
    assertThat(rule.isActive(), is(true));
  }
コード例 #2
0
ファイル: RuleFilter.java プロジェクト: Gael63/radar-netbeans
 @Override
 public boolean isValid(Issue issue) {
   return issue.ruleKey().equals(rule.getKey());
 }
コード例 #3
0
ファイル: RuleFilter.java プロジェクト: Gael63/radar-netbeans
 @Override
 public String getDescription() {
   return "Rule: " + rule.getTitle();
 }
コード例 #4
0
ファイル: RuleFilter.java プロジェクト: Gael63/radar-netbeans
 @Override
 public void apply(IssueQuery query) {
   query.rules(rule.getKey());
 }