Examples of ruleKey()


Examples of org.sonar.api.batch.rule.ActiveRule.ruleKey()

  private void createIssues(InputFile file, SensorContext context) {
    ActiveRule rule = context.activeRules().findByInternalKey(XooRulesDefinition.XOO_REPOSITORY,
      context.settings().getString(INTERNAL_KEY_PROPERTY));
    if (rule != null) {
      context.newIssue()
        .ruleKey(rule.ruleKey())
        .onFile(file)
        .message("This issue is generated on each file")
        .save();
    }
  }
View Full Code Here

Examples of org.sonar.api.batch.rule.ActiveRule.ruleKey()

    assertThat(activeRules.findByRepository("findbugs")).hasSize(1);
    assertThat(activeRules.findByInternalKey("squid", "__S0001__")).isNotNull();
    assertThat(activeRules.findByRepository("unknown")).isEmpty();

    ActiveRule squid1 = activeRules.find(RuleKey.of("squid", "S0001"));
    assertThat(squid1.ruleKey().repository()).isEqualTo("squid");
    assertThat(squid1.ruleKey().rule()).isEqualTo("S0001");
    assertThat(((DefaultActiveRule) squid1).name()).isEqualTo("My Rule");
    assertThat(squid1.severity()).isEqualTo(Severity.CRITICAL);
    assertThat(squid1.internalKey()).isEqualTo("__S0001__");
    assertThat(squid1.params()).hasSize(1);
View Full Code Here

Examples of org.sonar.api.batch.rule.ActiveRule.ruleKey()

    assertThat(activeRules.findByInternalKey("squid", "__S0001__")).isNotNull();
    assertThat(activeRules.findByRepository("unknown")).isEmpty();

    ActiveRule squid1 = activeRules.find(RuleKey.of("squid", "S0001"));
    assertThat(squid1.ruleKey().repository()).isEqualTo("squid");
    assertThat(squid1.ruleKey().rule()).isEqualTo("S0001");
    assertThat(((DefaultActiveRule) squid1).name()).isEqualTo("My Rule");
    assertThat(squid1.severity()).isEqualTo(Severity.CRITICAL);
    assertThat(squid1.internalKey()).isEqualTo("__S0001__");
    assertThat(squid1.params()).hasSize(1);
    assertThat(squid1.param("min")).isEqualTo("20");
View Full Code Here

Examples of org.sonar.api.batch.rule.ActiveRule.ruleKey()

    assertThat(squid1.internalKey()).isEqualTo("__S0001__");
    assertThat(squid1.params()).hasSize(1);
    assertThat(squid1.param("min")).isEqualTo("20");

    ActiveRule squid2 = activeRules.find(RuleKey.of("squid", "S0002"));
    assertThat(squid2.ruleKey().repository()).isEqualTo("squid");
    assertThat(squid2.ruleKey().rule()).isEqualTo("S0002");
    assertThat(squid2.severity()).isEqualTo(Severity.defaultSeverity());
    assertThat(squid2.params()).isEmpty();

    ActiveRule findbugsRule = activeRules.find(RuleKey.of("findbugs", "NPE"));
View Full Code Here

Examples of org.sonar.api.batch.rule.ActiveRule.ruleKey()

    assertThat(squid1.params()).hasSize(1);
    assertThat(squid1.param("min")).isEqualTo("20");

    ActiveRule squid2 = activeRules.find(RuleKey.of("squid", "S0002"));
    assertThat(squid2.ruleKey().repository()).isEqualTo("squid");
    assertThat(squid2.ruleKey().rule()).isEqualTo("S0002");
    assertThat(squid2.severity()).isEqualTo(Severity.defaultSeverity());
    assertThat(squid2.params()).isEmpty();

    ActiveRule findbugsRule = activeRules.find(RuleKey.of("findbugs", "NPE"));
    assertThat(findbugsRule.severity()).isEqualTo(Severity.defaultSeverity());
View Full Code Here

Examples of org.sonar.api.batch.sensor.issue.internal.DefaultIssue.ruleKey()

    } else {
      value.putNull();
    }
    value.put(issue.message());
    value.put(issue.effortToFix());
    value.put(issue.ruleKey().repository());
    value.put(issue.ruleKey().rule());
    Severity overridenSeverity = issue.overridenSeverity();
    if (overridenSeverity == null) {
      value.putNull();
    } else {
View Full Code Here

Examples of org.sonar.api.batch.sensor.issue.internal.DefaultIssue.ruleKey()

      value.putNull();
    }
    value.put(issue.message());
    value.put(issue.effortToFix());
    value.put(issue.ruleKey().repository());
    value.put(issue.ruleKey().rule());
    Severity overridenSeverity = issue.overridenSeverity();
    if (overridenSeverity == null) {
      value.putNull();
    } else {
      value.put(overridenSeverity.ordinal());
View Full Code Here

Examples of org.sonar.api.batch.sensor.issue.internal.DefaultIssue.ruleKey()

    }
    newIssue.message(value.getString());
    newIssue.effortToFix(value.isNull(true) ? null : value.getDouble());
    String repo = value.getString();
    String rule = value.getString();
    newIssue.ruleKey(RuleKey.of(repo, rule));
    newIssue.overrideSeverity(value.isNull(true) ? null : Severity.values()[value.getInt()]);
    return newIssue;
  }

}
View Full Code Here

Examples of org.sonar.api.issue.Issue.ruleKey()

    when(ruleFinder.findByKey(ruleKey)).thenReturn(rule);
    when(rule.getSeverity()).thenReturn(RulePriority.BLOCKER);

    Issue issue = mock(Issue.class);
    when(issue.isNew()).thenReturn(true);
    when(issue.ruleKey()).thenReturn(ruleKey);
    when(issue.message()).thenReturn("issue message");
    when(issue.componentKey()).thenReturn("componentKey");
    when(issue.line()).thenReturn(12);

    List<Issue> issues = new ArrayList<Issue>();
View Full Code Here

Examples of org.sonar.api.issue.Issue.ruleKey()

    assertThat(issueDoc.assignee()).isEqualTo(issue.getAssignee());
    assertThat(issueDoc.authorLogin()).isEqualTo(issue.getAuthorLogin());
    assertThat(issueDoc.closeDate()).isEqualTo(issue.getIssueCloseDate());
    assertThat(issueDoc.effortToFix()).isEqualTo(issue.getEffortToFix());
    assertThat(issueDoc.resolution()).isEqualTo(issue.getResolution());
    assertThat(issueDoc.ruleKey()).isEqualTo(RuleKey.of(issue.getRuleRepo(), issue.getRule()));
    assertThat(issueDoc.line()).isEqualTo(issue.getLine());
    assertThat(issueDoc.message()).isEqualTo(issue.getMessage());
    assertThat(issueDoc.reporter()).isEqualTo(issue.getReporter());
    assertThat(issueDoc.key()).isEqualTo(issue.getKey());
    assertThat(issueDoc.updateDate()).isEqualTo(issue.getIssueUpdateDate());
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.