Initial upgrade to new property mgmt scheme, much more to follow.
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6616 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package net.sourceforge.pmd.eclipse.runtime;
|
||||
|
||||
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
|
||||
import net.sourceforge.pmd.lang.rule.properties.IntegerProperty;
|
||||
|
||||
|
||||
/**
|
||||
@ -15,8 +16,8 @@ public class PMDRuntimeConstants {
|
||||
public static final String PMD_DFA_MARKER = PMDPlugin.PLUGIN_ID + ".pmdDFAMarker";
|
||||
public static final String PMD_TASKMARKER = PMDPlugin.PLUGIN_ID + ".pmdTaskMarker";
|
||||
|
||||
public static final String RULE_PROPERTY_MAXVIOLATIONS = "maxviolations";
|
||||
|
||||
public static final IntegerProperty MAX_VIOLATIONS_DESCRIPTOR = new IntegerProperty("maxviolations", "Max allowable violations", 1, Integer.MAX_VALUE-1, 1000, 0f);
|
||||
|
||||
public static final String ID_PERSPECTIVE = "net.sourceforge.pmd.eclipse.ui.views.pmdPerspective";
|
||||
|
||||
public static final String KEY_MARKERATT_RULENAME = "rulename";
|
||||
|
@ -321,7 +321,7 @@ public class BaseVisitor {
|
||||
final Review review = new Review();
|
||||
final Iterator<RuleViolation> iter = context.getReport().iterator();
|
||||
final IPreferences preferences = PMDPlugin.getDefault().loadPreferences();
|
||||
final int maxViolationsPerFilePerRule = preferences.getMaxViolationsPerFilePerRule();
|
||||
// final int maxViolationsPerFilePerRule = preferences.getMaxViolationsPerFilePerRule();
|
||||
final Map<Rule, Integer> violationsCounter = new HashMap<Rule, Integer>();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
@ -339,11 +339,8 @@ public class BaseVisitor {
|
||||
violationsCounter.put(violation.getRule(), counter);
|
||||
}
|
||||
|
||||
int maxViolations = violation.getRule().getProperty(PMDRuntimeConstants.MAX_VIOLATIONS_DESCRIPTOR);
|
||||
|
||||
int maxViolations = maxViolationsPerFilePerRule;
|
||||
if (violation.getRule().hasProperty(PMDRuntimeConstants.RULE_PROPERTY_MAXVIOLATIONS)) {
|
||||
maxViolations = violation.getRule().getIntProperty(PMDRuntimeConstants.RULE_PROPERTY_MAXVIOLATIONS);
|
||||
}
|
||||
if (counter.intValue() < maxViolations) {
|
||||
// Ryan Gustafson 02/16/2008 - Always use PMD_MARKER, as people get confused as to why PMD problems don't always show up on Problems view like they do when you do build.
|
||||
// markerSet.add(getMarkerInfo(violation, fTask ? PMDRuntimeConstants.PMD_TASKMARKER : PMDRuntimeConstants.PMD_MARKER));
|
||||
|
@ -215,9 +215,10 @@ public class ViolationOverviewLabelProvider extends LabelProvider implements ITa
|
||||
private int getMaxViolations(String ruleName) {
|
||||
int maxViolations = PMDPlugin.getDefault().loadPreferences().getMaxViolationsPerFilePerRule();
|
||||
final Rule rule = PMDPlugin.getDefault().getPreferencesManager().getRuleSet().getRuleByName(ruleName);
|
||||
if (rule != null && rule.hasProperty(PMDRuntimeConstants.RULE_PROPERTY_MAXVIOLATIONS)) {
|
||||
maxViolations = rule.getIntProperty(PMDRuntimeConstants.RULE_PROPERTY_MAXVIOLATIONS);
|
||||
if (rule != null) {
|
||||
return rule.getProperty(PMDRuntimeConstants.MAX_VIOLATIONS_DESCRIPTOR);
|
||||
}
|
||||
|
||||
return maxViolations;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user