org.sonar.api.rules.Rule.isEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.sonar.api.rules.Rule.isEnabled方法的一些代码示例,展示了Rule.isEnabled的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Rule.isEnabled方法的具体详情如下:
包路径:org.sonar.api.rules.Rule
类名称:Rule
方法名:isEnabled

Rule.isEnabled介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

/**
  * @since 2.6
  */
 public boolean isEnabled() {
  return getRule() != null && getRule().isEnabled();
 }
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void should_success_finder_wrap() {
 // has Id
 assertThat(underTest.findById(rule1.getId()).getId()).isEqualTo(rule1.getId());
 // should_find_by_id
 assertThat(underTest.findById(rule3.getId()).getConfigKey()).isEqualTo("Checker/Treewalker/AnnotationUseStyleCheck");
 // should_not_find_disabled_rule_by_id
 assertThat(underTest.findById(rule2.getId())).isNull();
 // should_find_by_key
 Rule rule = underTest.findByKey("checkstyle", "com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck");
 assertThat(rule).isNotNull();
 assertThat(rule.getKey()).isEqualTo(("com.puppycrawl.tools.checkstyle.checks.header.HeaderCheck"));
 assertThat(rule.isEnabled()).isTrue();
 // find_should_return_null_if_no_results
 assertThat(underTest.findByKey("checkstyle", "unknown")).isNull();
 assertThat(underTest.find(RuleQuery.create().withRepositoryKey("checkstyle").withConfigKey("unknown"))).isNull();
 // find_repository_rules
 assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey("checkstyle"))).hasSize(2);
 // find_all_enabled
 assertThat(underTest.findAll(RuleQuery.create())).extracting("id").containsOnly(rule1.getId(), rule3.getId(), rule4.getId());
 assertThat(underTest.findAll(RuleQuery.create())).hasSize(3);
 // do_not_find_disabled_rules
 assertThat(underTest.findByKey("checkstyle", "DisabledCheck")).isNull();
 // do_not_find_unknown_rules
 assertThat(underTest.findAll(RuleQuery.create().withRepositoryKey("unknown_repository"))).isEmpty();
}

代码示例来源:origin: org.codehaus.sonar/sonar-plugin-api

/**
  * @since 2.6
  */
 public boolean isEnabled() {
  return getRule() != null && getRule().isEnabled();
 }
}

代码示例来源:origin: org.sonarsource.sonarqube/sonar-plugin-api

/**
  * @since 2.6
  */
 public boolean isEnabled() {
  return getRule() != null && getRule().isEnabled();
 }
}

相关文章