Closed Zero3 closed 9 years ago
A simple and effective way would be to write one or more custom rulesets and to use them in lieu of the default ones you want to replace. In particular, please consider the following articles:
Thanks for the links. That could work. Recompiling a .jar every time you want to add/remove a rule is not too user-friendly though.
Would it be possible to place the custom .xml ruleset somewhere in your project folder instead? I'm thinking next to the other .xml settings files used by Netbeans.
Well, on the other hand, having a library of custom rulesets suitably packaged within jar files might foster reusability more than having a custom per-project file - and there is no recompilation, only packaging of static files. In my opinion, the best idea would be to simplify the creation of such jar files, in lieu of complicating the plugin's architecture with a custom approach... There should also be a way of employing rulesets without jar files, but I have never tried it out. Please, refer to: this link - EasyPmd should support custom classpaths as well.
Your link is exactly what I was trying to achieve! If I create such a file, how do I feed it to EasyPmd? The page suggests that some plugins look for it at "rulesets/rulesets.properties". Is this true for EasyPmd?
Ideally, you would be able to disable rules simply by clicking on the yellow bulb in Netbeans and selecting "Disable rule". This is how Findbugs and the SQE PMD plugin (https://kenai.com/projects/sqe/pages/Home) does it. It makes the process of starting with a very strict set of rules and selectively disabling individual ones very convenient.
Repackaging (sorry, not "compiling" of course :)) a text file into a .jar file by hand is quite cumbersome (in my humble opinion). I would have to do that many times as I discover new rules to include/exclude.
Good news! ^__^
Referencing a standalone ruleset XML file is possible right now (just write the full path of the XML descriptor in the dialog shown by the Add custom... button in the Rulesets tab), but I'm going to release EasyPmd 8, which will greatly simplify this feature! ^__^ Stay tuned!
EasyPmd 8.0 is ready! ^^ The NBM is right now available among the project's Release files and will soon be visible directly within the NetBeans IDE! ^^ I've also added you to the "Special Thanks" list! Thanks for your report! ^__^
Great! Thanks a lot! :+1:
I'm trying it out now. Unfortunately, the upgrade deleted my list of rulesets, and now I'm stuck with the default 3 (basic, imports, usedcode) :(. Anyway, I'll let you know if I run into any issues with it.
The options for EasyPmd 7 are still there, in your "$HOME/.EasyPmd7" directory... but, because of a massive architectural update, it was mandatory to upgrade the major version and, consequently, to store the new settings in "$HOME/.EasyPmd8". :) More stable settings might be a feature in a future version! ^__^!
Ahh, good to know!
Maybe I'm blind, but I can't figure out how to disable individual rules from a ruleset. Is this possible somehow? If not, could such a feature be added? :)