|
39 | 39 | import java.util.ArrayList;
|
40 | 40 | import java.util.Collection;
|
41 | 41 | import java.util.HashMap;
|
| 42 | +import java.util.HashSet; |
42 | 43 | import java.util.Iterator;
|
43 | 44 | import java.util.List;
|
44 | 45 | import java.util.Map;
|
@@ -96,7 +97,7 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
|
96 | 97 |
|
97 | 98 | private static final Logger LOG = Logger.getLogger(ReviewCodeCmd.class);
|
98 | 99 |
|
99 |
| - private final List<ISchedulingRule> resources = new ArrayList<ISchedulingRule>(); |
| 100 | + private final List<IResource> resources = new ArrayList<IResource>(); |
100 | 101 | private IResourceDelta resourceDelta;
|
101 | 102 | private Map<IFile, Set<MarkerInfo2>> markersByFile = new HashMap<IFile, Set<MarkerInfo2>>();
|
102 | 103 | private boolean taskMarker;
|
@@ -277,12 +278,12 @@ public void run() {
|
277 | 278 |
|
278 | 279 | // Log performance information
|
279 | 280 | if (fileCount > 0 && ruleCount > 0) {
|
280 |
| - logInfo("Review code command terminated. " + ruleCount + " rules were executed against " + fileCount |
| 281 | + logInfo("Review code command finished. " + ruleCount + " rules were executed against " + fileCount |
281 | 282 | + " files. Actual PMD duration is about " + pmdDuration + "ms, that is about "
|
282 | 283 | + (float) pmdDuration / fileCount + " ms/file, " + (float) pmdDuration / ruleCount
|
283 | 284 | + " ms/rule, " + (float) pmdDuration / ((long) fileCount * (long) ruleCount) + " ms/filerule");
|
284 | 285 | } else {
|
285 |
| - logInfo("Review code command terminated. " + ruleCount + " rules were executed against " + fileCount |
| 286 | + logInfo("Review code command finished. " + ruleCount + " rules were executed against " + fileCount |
286 | 287 | + " files. PMD was not executed.");
|
287 | 288 | }
|
288 | 289 | }
|
@@ -420,10 +421,13 @@ private ISchedulingRule getSchedulingRule() {
|
420 | 421 | * @throws CommandException
|
421 | 422 | */
|
422 | 423 | private void processResources() throws CommandException {
|
423 |
| - final Iterator<ISchedulingRule> i = resources.iterator(); |
424 |
| - while (i.hasNext()) { |
425 |
| - final IResource resource = (IResource) i.next(); |
| 424 | + Set<String> projects = new HashSet<String>(); |
| 425 | + for (IResource resource : resources) { |
| 426 | + projects.add(resource.getProject().getName()); |
| 427 | + } |
| 428 | + logInfo("ReviewCodeCmd started with " + resources.size() + " selected resources on projects " + projects); |
426 | 429 |
|
| 430 | + for (IResource resource : resources) { |
427 | 431 | // if resource is a project, visit only its source folders
|
428 | 432 | if (resource instanceof IProject) {
|
429 | 433 | processProject((IProject) resource);
|
@@ -508,7 +512,8 @@ private void processResource(IResource resource) throws CommandException {
|
508 | 512 | private void processProject(IProject project) throws CommandException {
|
509 | 513 | try {
|
510 | 514 | setStepCount(countResourceElement(project));
|
511 |
| - LOG.debug("Visiting project " + project.getName() + " : " + getStepCount()); |
| 515 | + logInfo("ReviewCodeCmd: visiting project " + project.getName() + ": " + getStepCount() + " resources found."); |
| 516 | + LOG.debug("Visiting project " + project.getName() + " : " + getStepCount() + " resources found."); |
512 | 517 |
|
513 | 518 | if (project.hasNature(JavaCore.NATURE_ID)) {
|
514 | 519 | processJavaProject(project);
|
@@ -609,6 +614,7 @@ private void processResourceDelta() throws CommandException {
|
609 | 614 | IResource resource = resourceDelta.getResource();
|
610 | 615 | final IProject project = resource.getProject();
|
611 | 616 | final IProjectProperties properties = getProjectProperties(project);
|
| 617 | + logInfo("ReviewCodeCmd started on resource delta " + resource.getName() + " in project " + project.getName()); |
612 | 618 |
|
613 | 619 | RuleSet ruleSet = rulesetFromResourceDelta(); // properties.getProjectRuleSet();
|
614 | 620 |
|
@@ -680,7 +686,7 @@ private void applyMarkers() {
|
680 | 686 | } finally {
|
681 | 687 | timer.stop();
|
682 | 688 | int count = markersByFile.size();
|
683 |
| - logInfo("" + violationCount + " markers applied on " + count + " files in " + timer.getDuration() + "ms."); |
| 689 | + LOG.info("" + violationCount + " markers applied on " + count + " files in " + timer.getDuration() + "ms."); |
684 | 690 | LOG.info("End of processing marker directives. " + violationCount + " violations for " + count + " files.");
|
685 | 691 | }
|
686 | 692 | }
|
|
0 commit comments