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

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

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

Rule.getPriority介绍

[英]Get the priority of this Rule.
[中]获取此规则的优先级。

代码示例

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

@Override
public RulePriority getPriority() {
  return rule.getPriority();
}

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

public void filterRulesByPriority(RulePriority minimumPriority) {
    Iterator<Rule> iterator = rules.iterator();
    while (iterator.hasNext()) {
      Rule rule = iterator.next();
      if (rule.getPriority().compareTo(minimumPriority) > 0) {
        LOG.fine("Removing rule " + rule.getName() + " due to priority: " + rule.getPriority() + " required: " + minimumPriority);
        iterator.remove();
      }
    }
  }
}

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

@Override
  public String get(int idx, RuleViolation rv, String cr) {
    return Integer.toString(rv.getRule().getPriority().getPriority());
  }
}), new ColumnDescriptor<>("line", "Line", new Accessor<RuleViolation>() {

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

/**
 * Rules are equal if:
 * <ol>
 * <li>They have the same implementation class.</li>
 * <li>They have the same name.</li>
 * <li>They have the same priority.</li>
 * <li>They share the same properties.</li>
 * </ol>
 */
@Override
public boolean equals(Object o) {
  if (o == null) {
    return false; // trivial
  }
  if (this == o) {
    return true; // trivial
  }
  boolean equality = getClass() == o.getClass();
  if (equality) {
    Rule that = (Rule) o;
    equality = getName().equals(that.getName()) && getPriority().equals(that.getPriority())
        && getPropertiesByPropertyDescriptor().equals(that.getPropertiesByPropertyDescriptor());
  }
  return equality;
}

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

maybeAdd("externalInfoUrl", rv.getRule().getExternalInfoUrl(), buf);
buf.append(" priority=\"");
buf.append(rv.getRule().getPriority().getPriority());
buf.append("\">").append(PMD.EOL);
StringUtil.appendXmlEscaped(buf, rv.getDescription(), useUTF8);

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

private <T> String getBody() {
  String result = "## " + rule.getName() + "\\n\\n" + "Since: PMD " + rule.getSince() + "\\n\\n" + "Priority: "
    + rule.getPriority() + "\\n\\n"
    + "[Categories](https://github.com/codeclimate/spec/blob/master/SPEC.md#categories): "
    + Arrays.toString(getCategories()).replaceAll("[\\[\\]]", "") + "\\n\\n"

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

lines.add("");
lines.add("**Priority:** " + rule.getPriority() + " (" + rule.getPriority().getPriority() + ")");
lines.add("");

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

issue.categories = getCategories();
switch (rule.getPriority()) {
case HIGH:
  issue.severity = "critical";

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

assertEquals(message + ", Rule message", rule1.getMessage(), rule2.getMessage());
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.getRuleClass(), rule.isDfa(), rule.isTypeResolution(), rule.isMultifile(),
rule.getDescription(),
rule.getPriority(), rule.getPropertyDescriptors(), rule.getPropertiesByPropertyDescriptor(),
rule.getExamples());

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

@Override
public RulePriority getPriority() {
  return rule.getPriority();
}

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

public void filterRulesByPriority(RulePriority minimumPriority) {
    Iterator<Rule> iterator = rules.iterator();
    while (iterator.hasNext()) {
      Rule rule = iterator.next();
      if (rule.getPriority().compareTo(minimumPriority) > 0) {
        LOG.fine("Removing rule " + rule.getName() + " due to priority: " + rule.getPriority() + " required: " + minimumPriority);
        iterator.remove();
      }
    }
  }
}

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

@Override
  public String get(int idx, RuleViolation rv, String cr) {
    return Integer.toString(rv.getRule().getPriority().getPriority());
  }
}), new ColumnDescriptor<>("line", "Line", new Accessor<RuleViolation>() {

代码示例来源:origin: nidi3/code-assert

private String printViolation(RuleViolation viol) {
    final Rule rule = viol.getRule();
    return String.format("%-11s %-45s %s:%d    %s",
        rule.getPriority(), rule.getName(), viol.getFilename(), viol.getBeginLine(), viol.getDescription());
  }
}

代码示例来源:origin: guru.nidi/code-assert

private String printViolation(RuleViolation viol) {
    final Rule rule = viol.getRule();
    return String.format("%-11s %-45s %s:%d    %s",
        rule.getPriority(), rule.getName(), viol.getFilename(), viol.getBeginLine(), viol.getDescription());
  }
}

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

/**
 * Rules are equal if:
 * <ol>
 * <li>They have the same implementation class.</li>
 * <li>They have the same name.</li>
 * <li>They have the same priority.</li>
 * <li>They share the same properties.</li>
 * </ol>
 */
@Override
public boolean equals(Object o) {
  if (o == null) {
    return false; // trivial
  }
  if (this == o) {
    return true; // trivial
  }
  boolean equality = getClass() == o.getClass();
  if (equality) {
    Rule that = (Rule) o;
    equality = getName().equals(that.getName()) && getPriority().equals(that.getPriority())
        && getPropertiesByPropertyDescriptor().equals(that.getPropertiesByPropertyDescriptor());
  }
  return equality;
}

代码示例来源:origin: guru.nidi/code-assert

@Override
public ActionResult accept(RuleViolation issue) {
  final int issuePrio = issue.getRule().getPriority().getPriority();
  return new ActionResult(minPriority == null || issuePrio <= minPriority.getPriority(), null, 1);
}

代码示例来源:origin: nidi3/code-assert

@Override
public ActionResult accept(RuleViolation issue) {
  final int issuePrio = issue.getRule().getPriority().getPriority();
  return new ActionResult(minPriority == null || issuePrio <= minPriority.getPriority(), null, 1);
}

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

issue.categories = getCategories();
switch (rule.getPriority()) {
case HIGH:
  issue.severity = "critical";

代码示例来源:origin: org.apache.maven.plugins/maven-pmd-plugin

private void processSingleRuleViolation( RuleViolation ruleViolation, PmdFileInfo fileInfo )
{
  sink.tableRow();
  sink.tableCell();
  sink.text( ruleViolation.getDescription() );
  sink.tableCell_();
  if ( this.renderRuleViolationPriority )
  {
    sink.tableCell();
    sink.text( String.valueOf( ruleViolation.getRule().getPriority().getPriority() ) );
    sink.tableCell_();
  }
  sink.tableCell();
  int beginLine = ruleViolation.getBeginLine();
  outputLineLink( beginLine, fileInfo );
  int endLine = ruleViolation.getEndLine();
  if ( endLine != beginLine )
  {
    sink.text( "&#x2013;" );
    outputLineLink( endLine, fileInfo );
  }
  sink.tableCell_();
  sink.tableRow_();
}

相关文章