pmd

Custom Java PMD rule: Can't find the class CustomRule

て烟熏妆下的殇ゞ 提交于 2019-12-10 10:41:52
问题 I'm trying to write custom PMD rules in Java. I have created a custom ruleset that looks like this: <?xml version="1.0"?> <ruleset name="Custom Ruleset" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"> <description> My custom rules </description> <rule name="CustomRule" message="Custom message" class="mwe.CustomRule"> <description>

In the Eclipe PMD plugin, can I reference the standard ruleset files?

雨燕双飞 提交于 2019-12-10 08:19:40
问题 I would like my eclipse PMD plugin configuration to access the same standard ruleset files as the maven-pmd-plugin. You can configure the maven pmd plugin to use a custom set of rule sets like this: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <version>2.5</version> <configuration> <rulesets> <!-- Two rule sets that come bundled with PMD --> <ruleset>/rulesets/braces.xml</ruleset> <ruleset>/rulesets/naming.xml</ruleset> <!-- Custom local file

Remove a single rule check from PMD in maven plugin

≯℡__Kan透↙ 提交于 2019-12-10 01:14:13
问题 I want to exclude a single PMD rule in POM, but it is not working. I have tried creating a pmd-exclude.xml (in the same dir as the pom.xml): <?xml version="1.0"?> <ruleset name="remove_rules"> <description>Remove rules</description> <rule ref="rulesets/unnecessary.xml"> <exclude name="UselessParentheses"/> </rule> </ruleset> From http://www.ing.iac.es/~docs/external/java/pmd/howtomakearuleset.html and referenced it in pom.xml: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId

Custom PMD Rule - Check Package Comment In Place

爷,独闯天下 提交于 2019-12-08 06:49:55
问题 I'm trying to write a rule to enforce that a package contains a Javadoc comment with a particular expression, e.g: /** * Example Expression */ Does anybody know how I would write such a rule using the AbstractJavaRule class. I've looked at ASTPackageDeclaration, but this doesn't appear to have what I want. Many thanks in advance... 回答1: PMD uses JavaCC to parse each java file into an Abstract Syntax Tree. Typically parsers used for compilation just drop comments, and from what I can gather on

How to hook PMD + Clover in Hudson build using maven?

℡╲_俬逩灬. 提交于 2019-12-08 06:26:23
问题 we have newly set-up up a Hudson (yes.. Hudson, not Jenkins) CI. The job scheduled in Hudson does the following a. Connects to IBM ClearCase repository to download the latest source code b. Compiles all java source code and Creates a WAR file (by running the project's pom.xml) c. Deploys it to a Tomcat6 server Now, i want to take it one more step further in-terms of bringing in automatic 'Static Code Analyzers' in this process. I installed PMD/Clover/JavaNCSS plugins in my Hudson instance,

Analyzing Javascript with PMD Maven

别说谁变了你拦得住时间么 提交于 2019-12-08 04:11:21
问题 I'm currently trying out PMD as a possible static analysis tool that our company can use. I've analyzed Java files with no problems whatsoever, but I couldn't seem to do it with Javascript, everytime I execute pmd:pmd it just analyses java files again. Anyways, here is a snippet of my POM.xml: *Using Maven 3.3.1 <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <version>3.0.0</version> <configuration> <sources> ${basedir}/src

How to hook PMD + Clover in Hudson build using maven?

廉价感情. 提交于 2019-12-07 11:35:28
we have newly set-up up a Hudson (yes.. Hudson, not Jenkins) CI. The job scheduled in Hudson does the following a. Connects to IBM ClearCase repository to download the latest source code b. Compiles all java source code and Creates a WAR file (by running the project's pom.xml) c. Deploys it to a Tomcat6 server Now, i want to take it one more step further in-terms of bringing in automatic 'Static Code Analyzers' in this process. I installed PMD/Clover/JavaNCSS plugins in my Hudson instance, but while looking at it's setting, it looks like, these plugins will not perform the static code

CollapsibleIfStatements

早过忘川 提交于 2019-12-07 05:02:25
问题 I recently stumpled upon the following warning using PMD (embedded in hudson), my code seems to suffer CollapsibleIfStatements , which I do not fully understand. The code looks like this // list to be filled with unique Somethingness List list = new ArrayList(); // fill list for (SomeObject obj : getSomeObjects()) { // interating if (!obj.getSomething().isEmpty()) { // check if "Something" is empty * if (!list.contains(obj.getSomething())) { // check if "Something" is already in my list **

What is the full form of PMD?

妖精的绣舞 提交于 2019-12-07 03:34:07
问题 I am using PMD in my Java project for code review. Just want to know what the acronym "P.M.D." stands for. I searched on Google but could not find anything. Does anyone know? 回答1: On the PMD project site you can find that they don't really know the meaning of the PMD letters. They just think the letters sound good together. You can find several "backronyms" to explain it on the PMD project site: Pretty Much Done Project Mess Detector Project Monitoring Directives Project Meets Deadline

Custom Java PMD rule: Can't find the class CustomRule

走远了吗. 提交于 2019-12-06 05:10:56
I'm trying to write custom PMD rules in Java. I have created a custom ruleset that looks like this: <?xml version="1.0"?> <ruleset name="Custom Ruleset" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"> <description> My custom rules </description> <rule name="CustomRule" message="Custom message" class="mwe.CustomRule"> <description> Custom description </description> <priority>3</priority> </rule> </ruleset> I call pmd.bat using this