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

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

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

Rule.setParams介绍

[英]Sets the rule parameters
[中]设置规则参数

代码示例

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

@Override
 public RulesProfile createProfile(ValidationMessages validation) {
  RulesProfile profile1 = RulesProfile.create("Profile 1", "xoo");
  profile1.activateRule(Rule.create("repo1", "defaultSeverity"), null);
  profile1.activateRule(Rule.create("repo1", "overrideSeverity"), RulePriority.CRITICAL);
  Rule ruleWithParam = Rule.create("repo1", "overrideParam");
  ruleWithParam.setParams(Arrays.asList(new RuleParam(ruleWithParam, "param", "", "")));
  ActiveRule arWithParam = profile1.activateRule(ruleWithParam, null);
  arWithParam.setParameter("param", "value");
  return profile1;
 }
}

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

.setDefaultValue(param.getDefaultValue()));
apiRule.setParams(apiParams);

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

.setDefaultValue(param.getDefaultValue()));
apiRule.setParams(apiParams);

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

.setDefaultValue(param.getDefaultValue()));
apiRule.setParams(apiParams);

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

.setDefaultValue(param.getDefaultValue()));
apiRule.setParams(apiParams);

代码示例来源:origin: fabriciocolombo/sonar-delphi

private static Rule createRepositoryRule(DelphiRule fRule) {
 RulePriority priority = severityFromLevel(fRule.getPriority());
 Rule rule = Rule.create(DelphiPmdConstants.REPOSITORY_KEY, fRule.getName(), fRule.getMessage()).setSeverity(
  priority);
 rule.setDescription(fRule.getDescription());
 rule.setTags(fRule.getTags());
 rule.setConfigKey(fRule.getClazz());
 List<RuleParam> ruleParams = new ArrayList<RuleParam>();
 if (fRule.getProperties() != null) {
  for (Property property : fRule.getProperties()) {
   RuleParam param = rule.createParameter()
    .setKey(property.getName())
    .setDescription(property.getName())
    .setType("s");
   if (NumberUtils.isNumber(property.getValue())) {
    param.setType("i");
   }
   param.setDefaultValue(property.getValue());
   ruleParams.add(param);
  }
 }
 rule.setParams(ruleParams);
 return rule;
}

相关文章