Menu

#1350 Check code after saving runs PMD unnecessarily

Eclipse-Plugin
closed
None
Eclipse
3-Major
Bug
2015-06-08
2015-05-09
No

The option "Check code after saving" is useful, if the workspace setting "Build automatically" is turned off. Then you can let PMD run anyway.

However, if "Build automatically" is on, then PMD is run once through the project builder and once through the "Check code after saving" mechanism.

Related

Issues: #1435
Discussion: PMD-Plugin does not respect the global preference setting

Discussion

  • Andreas Dangel

    Andreas Dangel - 2015-05-09
    1. If "Build automatically" is turned on, then the global change listener doesn't need to execute anything - as eclipse would then call PMD Builders, to actually run PMD.
    2. If "Build automatically" is turned off, then the global change listener should run PMD - but only, if PMD has been activated for the project. Otherwise you would run PMD for all projects and there would be no way to disable it.
     
  • Andreas Dangel

    Andreas Dangel - 2015-05-09
    • summary: Check code after saving runs PMD uneccesarily --> Check code after saving runs PMD unnecessarily
     
  • Andreas Dangel

    Andreas Dangel - 2015-05-09
    • status: in-progress --> closed
     
  • L.W.

    L.W. - 2015-06-05

    Can't get to work "Check Code after saving" now without activating "Full Build enabled".
    I don't want PMD to check on full build but I want it to check the files I modify.

     
    • Andreas Dangel

      Andreas Dangel - 2015-06-05

      Hi,
      I'd suggest, just enable this property "Full Build enabled". The name of the property is not very good (probably in the past it was really only about full builds), but the "PMD Builder" (which internally calls PMD) is called for each of the different kinds: AUTO_BUILD, FULL_BUILD, INCREMENTAL_BUILD. So, even if the property is called "Full Build enabled", it just means, whether to run PMD on each change or not.

      Regards,
      Andreas

       
  • L.W.

    L.W. - 2015-06-08

    That is not really the same.
    In the previous version I could disable "Full build enabled" and enable "Check code after saving". With these settings PMD checked all classes I modified and saved but it did NOT check all classes on a full build.

    Now I have to enable "Full build enabled" which causes PMD to additionally check ALL classes on a full build.

    In short, PMD should trigger from saving not from compiling.

    Perhaps it is possible to also cover this case so that PMD runs with
    "Build automatically": true, "Full build enabled": false, "Check code after saving": true

     
  • Andreas Dangel

    Andreas Dangel - 2015-06-08

    That's a good point you make. Thanks for explaining this! Now I understand, what the property Full build enabled is really for (before I was wondering, why this property actually is needed....)

    Ok, so, looking at the code, I see, that it should work, even if "Full build enabled" is disabled - because it determines how many files are changed and if only one file is changed, PMD is executed.

    However, I seems like this doesn't work - and previously, this bug was hidden by the fact, that "Check code after saving" has been executed always.

    IMHO, integrating PMD via builders is the correct way, e.g. this is done by the checkstyle plugin and the findbugs plugin. Btw. I just saw, that findbugs has a similar option: "run also on full build".

    I'll probably create a new bug for this - but I'm not sure, how soon I find time to work it...

    Regards,
    Andreas

     

Log in to post a comment.