net.sourceforge.pmd.Rule.getExamples()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(164)

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

Rule.getExamples介绍

[英]Get the list of examples for this Rule.
[中]获取此规则的示例列表。

代码示例

代码示例来源:origin: pmd/pmd

@Override
public List<String> getExamples() {
  return rule.getExamples();
}

代码示例来源:origin: pmd/pmd

+ getRemediationPoints() + "\\n\\n" + cleaned(rule.getDescription());
if (!rule.getExamples().isEmpty()) {
  result += "\\n\\n### Example:\\n\\n";
  for (String snippet : rule.getExamples()) {
    String exampleSnippet = snippet.replaceAll("\\n", "\\\\n");
    exampleSnippet = exampleSnippet.replaceAll("\\t", "\\\\t");

代码示例来源:origin: pmd/pmd

if (!rule.getExamples().isEmpty()) {
  lines.add("**Example(s):**");
  lines.add("");
  for (String example : rule.getExamples()) {
    lines.add("``` " + mapLanguageForHighlighting(languageTersename));
    lines.addAll(toLines(StringUtils.stripToEmpty(example)));

代码示例来源:origin: pmd/pmd

assertEquals(message + ", Rule external info url", rule1.getExternalInfoUrl(), rule2.getExternalInfoUrl());
assertEquals(message + ", Rule priority", rule1.getPriority(), rule2.getPriority());
assertEquals(message + ", Rule examples", rule1.getExamples(), rule2.getExamples());

代码示例来源:origin: pmd/pmd

rule.getDescription(),
rule.getPriority(), rule.getPropertyDescriptors(), rule.getPropertiesByPropertyDescriptor(),
rule.getExamples());

代码示例来源:origin: net.sourceforge.pmd/pmd-core

@Override
public List<String> getExamples() {
  return rule.getExamples();
}

代码示例来源:origin: org.jvnet.hudson.plugins/pmd

/**
   * Creates the message string to be shown for the specified rule.
   *
   * @param rule
   *            the rule
   * @return the message string to be shown for the specified rule
   */
  private String createMessage(final Rule rule) {
    List<String> examples = rule.getExamples();
    if (!examples.isEmpty()) {
      return rule.getDescription() + "<pre>" + examples.get(0) + "</pre>";
    }
    return rule.getDescription();
  }
}

代码示例来源:origin: jenkinsci/pmd-plugin

/**
   * Creates the message string to be shown for the specified rule.
   *
   * @param rule
   *            the rule
   * @return the message string to be shown for the specified rule
   */
  private String createMessage(final Rule rule) {
    List<String> examples = rule.getExamples();
    if (!examples.isEmpty()) {
      return rule.getDescription() + "<pre>" + examples.get(0) + "</pre>";
    }
    return rule.getDescription();
  }
}

代码示例来源:origin: org.hudsonci.plugins/pmd

/**
   * Creates the message string to be shown for the specified rule.
   *
   * @param rule
   *            the rule
   * @return the message string to be shown for the specified rule
   */
  private String createMessage(final Rule rule) {
    List<String> examples = rule.getExamples();
    if (!examples.isEmpty()) {
      return rule.getDescription() + "<pre>" + examples.get(0) + "</pre>";
    }
    return rule.getDescription();
  }
}

代码示例来源:origin: jenkinsci/warnings-ng-plugin

/**
   * Creates the message string to be shown for the specified rule.
   *
   * @param rule
   *         the rule
   *
   * @return the message string to be shown for the specified rule
   */
  private String createMessage(final Rule rule) {
    StringBuilder message = new StringBuilder(rule.getDescription());
    List<String> examples = rule.getExamples();
    if (!examples.isEmpty()) {
      message.append(pre().with(code(examples.get(0))).renderFormatted());
    }
    if (StringUtils.isNotBlank(rule.getExternalInfoUrl())) {
      message.append(a().withHref(rule.getExternalInfoUrl()).withText("See PMD documentation.").renderFormatted());
    }
    return message.toString();
  }
}

代码示例来源:origin: net.sourceforge.pmd/pmd-core

+ getRemediationPoints() + "\\n\\n" + cleaned(rule.getDescription());
if (!rule.getExamples().isEmpty()) {
  result += "\\n\\n### Example:\\n\\n";
  for (String snippet : rule.getExamples()) {
    String exampleSnippet = snippet.replaceAll("\\n", "\\\\n");
    exampleSnippet = exampleSnippet.replaceAll("\\t", "\\\\t");

代码示例来源:origin: net.sourceforge.pmd/pmd-test

assertEquals(message + ", Rule external info url", rule1.getExternalInfoUrl(), rule2.getExternalInfoUrl());
assertEquals(message + ", Rule priority", rule1.getPriority(), rule2.getPriority());
assertEquals(message + ", Rule examples", rule1.getExamples(), rule2.getExamples());

代码示例来源:origin: net.sourceforge.pmd/pmd-core

rule.getDescription(),
rule.getPriority(), rule.getPropertyDescriptors(), rule.getPropertiesByPropertyDescriptor(),
rule.getExamples());

相关文章