pmd-eclipse: better fix for #1071 Violations are reported multiple times
The markers for a file are now cleared always before new markers are created/added to the file.
This commit is contained in:
1 parent
e1e03f8645
commit
2107bef4ee
3 files changed
+3
-16
No files matched your search
-1
@@ -81,7 +81,6 @@ public class FileChangeReviewer implements IResourceChangeListener {
|
||||
if (itemsChanged.isEmpty()) return;
|
||||
|
||||
ReviewCodeCmd cmd = new ReviewCodeCmd(); // separate one for each thread
|
||||
cmd.clearExistingMarkersBeforeApplying(true);
|
||||
cmd.reset();
|
||||
|
||||
for (ResourceChange chg : itemsChanged) cmd.addResource(chg.file);
|
||||
|
||||
-2
@@ -90,7 +90,6 @@ public class PMDBuilder extends IncrementalProjectBuilder {
|
||||
cmd.setResourceDelta(resourceDelta);
|
||||
cmd.setTaskMarker(false);
|
||||
cmd.setMonitor(monitor);
|
||||
cmd.clearExistingMarkersBeforeApplying(true);
|
||||
cmd.performExecute(); // a builder is always asynchronous; execute a command synchronously whatever its processor
|
||||
} else {
|
||||
log.info("No change reported. Performing no build");
|
||||
@@ -109,7 +108,6 @@ public class PMDBuilder extends IncrementalProjectBuilder {
|
||||
cmd.addResource(project);
|
||||
cmd.setTaskMarker(false);
|
||||
cmd.setMonitor(monitor);
|
||||
cmd.clearExistingMarkersBeforeApplying(true);
|
||||
cmd.performExecute(); // a builder is always asynchronous; execute a command synchronously whatever its processor
|
||||
}
|
||||
|
||||
|
||||
+3
-13
@@ -100,7 +100,6 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
private int ruleCount;
|
||||
private int fileCount;
|
||||
private long pmdDuration;
|
||||
private boolean clearExistingMarkersBeforeApplying;
|
||||
private String onErrorIssue = null;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -118,10 +117,6 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
setTerminated(false);
|
||||
}
|
||||
|
||||
public void clearExistingMarkersBeforeApplying(boolean flag) {
|
||||
clearExistingMarkersBeforeApplying = flag;
|
||||
}
|
||||
|
||||
public Set<IFile> markedFiles() {
|
||||
return markersByFile.keySet();
|
||||
}
|
||||
@@ -532,17 +527,12 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
||||
|
||||
try {
|
||||
for (IFile file : markersByFile.keySet()) {
|
||||
if (isCanceled()) break;
|
||||
if (isCanceled()) break;
|
||||
currentFile = file.getName();
|
||||
|
||||
MarkerUtil.deleteAllMarkersIn(file);
|
||||
Set<MarkerInfo2> markerInfoSet = markersByFile.get(file);
|
||||
|
||||
if (clearExistingMarkersBeforeApplying) {
|
||||
MarkerUtil.deleteAllMarkersIn(file);
|
||||
}
|
||||
|
||||
for (MarkerInfo2 markerInfo : markerInfoSet) {
|
||||
markerInfo.addAsMarkerTo(file);
|
||||
markerInfo.addAsMarkerTo(file);
|
||||
violationCount++;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user