Check code after saving runs PMD unnecessarily
A source code analyzer
Brought to you by:
adangel,
juansotuyo
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.
Issues: #1435
Discussion: PMD-Plugin does not respect the global preference setting
This will be fixed with the next version.
You can test the new version by installing the latest plugin version from
https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site-latest/
Commit: https://github.com/pmd/pmd-eclipse-plugin/commit/2a114113db987d1c584f3137a538d2a427994b3b
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.
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
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
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