I would prefer to write
@SuppressWarnings(PMD.ShortVariable)
// with public static final String ShortVariable = "PMD.ShortVariable"; in class PMD.
instead of
@SuppressWarnings("PMD.ShortVariable")
But when using constants PMD ignores the annotation.
Have I made a mistake or is there another reason?
...
Is there a good resource which describes the "why" behind PMD rule sets? PMD's site has the "what" - what each rule does - but it doesn't describe why PMD has that rule and why ignoring that rule can get you in trouble in the real world. In particular, I'm interested in knowing why PMD has the AvoidInstantiatingObjectsInLoops and OnlyOne...
Hi all,
I'm using the PMD plugin for eclipse and it gives me an error when using System.out.println() with the explanation:
System.(out|err).print is used, consider using a logger.
My question is - What is a Logger? How is it used to print to the screen? Why is it better?
Thanks.
...
Can PMD be customized to fully support a new language, in a reasonable amount of time. I mean I know that technically almost anything can be done, but im wondering if this can be done in a reasonable amount of time? E.g. < 2 weeks
This page mentions how to write a CPD parser http://pmd.sourceforge.net/cpd-parser-howto.html
But is this...
Guys, I wanted generate the pmd report while building the project so I have added plugin to build section of my pom.xml but still it don't execute until I explicitly call mvn clean install pmd:pmd. I want to execute it with mvn clean install itself. is it possible ? my pom entries are as under:
<build>
<plugins>
<plugin>
...
I'd like to use a custom PMD ruleset file for my build. Basically, I want to use many of the built-in ruleset packages with some rules turned off.
For example, suppose I only wanted the strings and basics rules, I have this ruleset file, called ruleset.xml:
<?xml version="1.0"?>
<ruleset name="Custom ruleset"
xmlns="http://pm...
I have
if (localName.equals("TaxName")) {
but PMD says
Position literals first in String comparisons
...
Could someone suggest a PMD xpath rule to warn that calling the equals() method of java.math.BigDecimal will check for both value and scale which usually (unless for some engineering type apps) might be a mistake. sine 1.0 not equals 1.00, one should use compareTo.
...
PMD has a rule called ArrayIsStoredDirectly in the Sun Security ruleset:
Constructors and methods receiving arrays should clone objects and store the copy. This prevents that future changes from the user affect the internal functionality.
Here is their example:
public class Foo {
private String [] x;
public void foo (String [] ...
Hi everybody.
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.
...
Hello,
My requirement is to parse java files and find the classes or interfaces which implement a particular interface. Hence I started with implementing custom rules in PMD. I was able to write an XPath expression to search the classes & interfaces but was not able to figure out the right way to pass the interface name for which the ...
It is possible to take the source code directly from a svn repository and analyze it with sonar? Or configure sonar just to run a Checkstyle or pmd plugin for certain sources?
I need to do this on non-maven projects.
...
How can we add a new java based pmd rule in eclipse pmd plugin?
I am getting following error:
Invalid Class implementation.The class must be in plugin classpath and implement the rule interface.
I have extended rule class with AbstractRule class.
...
How can I lock the version of a Maven plugin I want to use?
I have the PMD plugin configured like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
<configuration>
<outputDirectory>...
According to the tool PMD, the following is a bad practice:
String s = "" + 123; // bad
String t = Integer.toString(456); // ok
This is an inefficient way to convert any type to a `String`.
Why is it a bad thing to do?
...
Hi
i am new in flex, i installed command line flexpmd in my flexbuilder to improve my common coding mistake and for code optimization.
when i run pmd it gives a lot of errors,warning , that's fine i want to export this result in a txt or csv file .
please share u'r experience regarding this with explanation.
...
I am damm confusing to create a new PMD rule in ruleset!
can anyone guide me to the approach to do so?
thanks in advance!
...
Could someone please help me to create rule in pmd for eclipse? I am unable to start even i followed through PMD official site. I am planning to create rule in java instead of XPath rule. Any simple guidelines to start it?
Thanks
...
i need a PMD java class for checking comments on java code. I am working on MyEclipse IDE. any idea?
...
hello all, i am trying to write a java pmd rule to check source code comments. The rule should be able to identify all the method and variable declarations. If any method/variable declares without comment, the rule should give a warning as method/variable created without comments. any idea will be appreciated.......!
...