开发者

PMD and auto generated code in Netbeans

开发者_如何学Python

I'm using Netbeans to build a GUI application and PMD "complains" about things in the auto-generated code. Can I configure PMD to ignore auto-generated code (as I did with Checkstyle)?

Thank you.


There are a couple things that you can do:

A. Alter the template for the type of form to include some of the magic strings that are discussed on this page about suppressing PMD warnings.

  1. Use the Templates item of the Tools menu to open the 'Template Manager' dialog.

  2. Find the folder labeled 'Swing GUI Forms' and expand that node.

  3. Select a template and press the 'Open in Editor' button.

  4. Change the @SuppressWarnings("unchecked") to @SuppressWarnings({"unchecked", "PMD"})

Note: You can apply this last step to any of the forms that you have already created.

B. Create a ruleset that does not include the warnings that get violated by the generated code and use that ruleset instead. There is a page that discusses creating rulesets and a page that describes how to direct PMD to use an explicit ruleset when executed from the command line.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜