typos & minor optimizations
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@6674 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
@ -222,7 +222,7 @@ public abstract class AbstractDefaultCommand extends AbstractProcessableCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* deletegate method for monitor.isCanceled()
|
* delegate method for monitor.isCanceled()
|
||||||
* @see org.eclipse.core.runtime.IProgressMonitor#isCanceled
|
* @see org.eclipse.core.runtime.IProgressMonitor#isCanceled
|
||||||
*/
|
*/
|
||||||
protected boolean isCanceled() {
|
protected boolean isCanceled() {
|
||||||
|
@ -48,6 +48,7 @@ import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
|
|||||||
import net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences;
|
import net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences;
|
||||||
import net.sourceforge.pmd.eclipse.runtime.properties.IProjectProperties;
|
import net.sourceforge.pmd.eclipse.runtime.properties.IProjectProperties;
|
||||||
import net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException;
|
import net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException;
|
||||||
|
import net.sourceforge.pmd.util.NumericConstants;
|
||||||
|
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
@ -335,7 +336,7 @@ public class BaseVisitor {
|
|||||||
} else {
|
} else {
|
||||||
Integer counter = violationsCounter.get(violation.getRule());
|
Integer counter = violationsCounter.get(violation.getRule());
|
||||||
if (counter == null) {
|
if (counter == null) {
|
||||||
counter = new Integer(0);
|
counter = NumericConstants.ZERO;
|
||||||
violationsCounter.put(violation.getRule(), counter);
|
violationsCounter.put(violation.getRule(), counter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,7 +353,7 @@ public class BaseVisitor {
|
|||||||
markerSet.add(getMarkerInfo(violation, fTask ? PMDRuntimeConstants.PMD_TASKMARKER : PMDRuntimeConstants.PMD_MARKER));
|
markerSet.add(getMarkerInfo(violation, fTask ? PMDRuntimeConstants.PMD_TASKMARKER : PMDRuntimeConstants.PMD_MARKER));
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
violationsCounter.put(violation.getRule(), new Integer(counter.intValue() + 1));
|
violationsCounter.put(violation.getRule(), Integer.valueOf(counter.intValue() + 1));
|
||||||
|
|
||||||
log.debug("Adding a violation for rule " + violation.getRule().getName() + " at line " + violation.getBeginLine());
|
log.debug("Adding a violation for rule " + violation.getRule().getName() + " at line " + violation.getBeginLine());
|
||||||
} else {
|
} else {
|
||||||
@ -448,38 +449,38 @@ public class BaseVisitor {
|
|||||||
values.add(violation.getDescription());
|
values.add(violation.getDescription());
|
||||||
|
|
||||||
attributeNames.add(IMarker.LINE_NUMBER);
|
attributeNames.add(IMarker.LINE_NUMBER);
|
||||||
values.add(new Integer(violation.getBeginLine()));
|
values.add(Integer.valueOf(violation.getBeginLine()));
|
||||||
|
|
||||||
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_LINE2);
|
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_LINE2);
|
||||||
values.add(new Integer(violation.getEndLine()));
|
values.add(Integer.valueOf(violation.getEndLine()));
|
||||||
|
|
||||||
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_RULENAME);
|
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_RULENAME);
|
||||||
values.add(violation.getRule().getName());
|
values.add(violation.getRule().getName());
|
||||||
|
|
||||||
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_PRIORITY);
|
attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_PRIORITY);
|
||||||
values.add(new Integer(violation.getRule().getPriority().getPriority()));
|
values.add(Integer.valueOf(violation.getRule().getPriority().getPriority()));
|
||||||
|
|
||||||
switch (violation.getRule().getPriority().getPriority()) {
|
switch (violation.getRule().getPriority().getPriority()) {
|
||||||
case 1:
|
case 1:
|
||||||
attributeNames.add(IMarker.PRIORITY);
|
attributeNames.add(IMarker.PRIORITY);
|
||||||
values.add(new Integer(IMarker.PRIORITY_HIGH));
|
values.add(Integer.valueOf(IMarker.PRIORITY_HIGH));
|
||||||
case 2:
|
case 2:
|
||||||
attributeNames.add(IMarker.SEVERITY);
|
attributeNames.add(IMarker.SEVERITY);
|
||||||
values.add(new Integer(IMarker.SEVERITY_ERROR));
|
values.add(Integer.valueOf(IMarker.SEVERITY_ERROR));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
attributeNames.add(IMarker.SEVERITY);
|
attributeNames.add(IMarker.SEVERITY);
|
||||||
values.add(new Integer(IMarker.SEVERITY_INFO));
|
values.add(Integer.valueOf(IMarker.SEVERITY_INFO));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
attributeNames.add(IMarker.PRIORITY);
|
attributeNames.add(IMarker.PRIORITY);
|
||||||
values.add(new Integer(IMarker.PRIORITY_HIGH));
|
values.add(Integer.valueOf(IMarker.PRIORITY_HIGH));
|
||||||
case 4:
|
case 4:
|
||||||
default:
|
default:
|
||||||
attributeNames.add(IMarker.SEVERITY);
|
attributeNames.add(IMarker.SEVERITY);
|
||||||
values.add(new Integer(IMarker.SEVERITY_WARNING));
|
values.add(Integer.valueOf(IMarker.SEVERITY_WARNING));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,9 +105,9 @@ public class DetectCutAndPasteCmd extends AbstractDefaultCommand {
|
|||||||
final List<File> files = findFiles();
|
final List<File> files = findFiles();
|
||||||
|
|
||||||
if (files.size() == 0) {
|
if (files.size() == 0) {
|
||||||
PMDPlugin.getDefault().logInformation("No files found to specified language.");
|
PMDPlugin.getDefault().logInformation("No files found for specified language.");
|
||||||
} else {
|
} else {
|
||||||
PMDPlugin.getDefault().logInformation("Found " + files.size() + " files to the specified language. Performing CPD.");
|
PMDPlugin.getDefault().logInformation("Found " + files.size() + " files for the specified language. Performing CPD.");
|
||||||
}
|
}
|
||||||
setStepsCount(files.size());
|
setStepsCount(files.size());
|
||||||
beginTask("Finding suspect Cut And Paste", getStepsCount()*2);
|
beginTask("Finding suspect Cut And Paste", getStepsCount()*2);
|
||||||
|
@ -77,7 +77,7 @@ public class RenderReportCmd extends AbstractDefaultCommand {
|
|||||||
/**
|
/**
|
||||||
* Table containing the renderers indexed by the file name.
|
* Table containing the renderers indexed by the file name.
|
||||||
*/
|
*/
|
||||||
private HashMap<String, Renderer> renderers = new HashMap<String, Renderer>();
|
private Map<String, Renderer> renderers = new HashMap<String, Renderer>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
|
@ -120,7 +120,7 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
|||||||
this.pmdDuration = 0;
|
this.pmdDuration = 0;
|
||||||
|
|
||||||
// Lancer PMD
|
// Lancer PMD
|
||||||
if (this.resources.size() == 0) {
|
if (this.resources.isEmpty()) {
|
||||||
beginTask("PMD Checking...", getStepsCount());
|
beginTask("PMD Checking...", getStepsCount());
|
||||||
processResourceDelta();
|
processResourceDelta();
|
||||||
} else {
|
} else {
|
||||||
@ -251,7 +251,7 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
|||||||
final IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
|
final IResourceRuleFactory ruleFactory = workspace.getRuleFactory();
|
||||||
ISchedulingRule rule = null;
|
ISchedulingRule rule = null;
|
||||||
|
|
||||||
if (this.resources.size() == 0) {
|
if (this.resources.isEmpty()) {
|
||||||
rule = ruleFactory.markerRule(this.resourceDelta.getResource().getProject());
|
rule = ruleFactory.markerRule(this.resourceDelta.getResource().getProject());
|
||||||
} else {
|
} else {
|
||||||
ISchedulingRule rules[] = new ISchedulingRule[this.resources.size()];
|
ISchedulingRule rules[] = new ISchedulingRule[this.resources.size()];
|
||||||
|
@ -123,9 +123,7 @@ public class ReviewResourceForRuleCommand extends AbstractDefaultCommand {
|
|||||||
final IFile file = (IFile) resource.getAdapter(IFile.class);
|
final IFile file = (IFile) resource.getAdapter(IFile.class);
|
||||||
beginTask("PMD Checking for specific rule...", 1);
|
beginTask("PMD Checking for specific rule...", 1);
|
||||||
|
|
||||||
if (file != null
|
if (file != null && "java".equals(file.getFileExtension())) {
|
||||||
&& file.getFileExtension() != null
|
|
||||||
&& file.getFileExtension().equals("java")) {
|
|
||||||
final RuleSet ruleSet = new RuleSet();
|
final RuleSet ruleSet = new RuleSet();
|
||||||
ruleSet.addRule(rule);
|
ruleSet.addRule(rule);
|
||||||
final PMDEngine pmdEngine = getPmdEngineForProject(project);
|
final PMDEngine pmdEngine = getPmdEngineForProject(project);
|
||||||
|
Reference in New Issue
Block a user