Questions tagged [pmd]

PMD scans source code and looks for potential problems like possible bugs, dead code, suboptimal code, overcomplicated expressions, and duplicate code. PMD supports Java, JavaScript, XML, and many more.

PMD scans source code and looks for potential problems like possible bugs, dead code, suboptimal code, overcomplicated expressions, and .

857 questions
0
votes
1 answer

creatRuleViolation how to define it? Save me from this

Help. I would like to sacrifice the reputation for a proper answer.. public class ParameterNameConvention extends AbstractJavaRule { private final static String PATTERN = "[p][a-zA-Z]+"; public Object visit(ASTMethodDeclaration node, Object…
Esct
  • 133
  • 1
  • 2
  • 13
0
votes
2 answers

Implicit super constructor AbstractNcssCountRule() is undefined for default constructor. Must define an explicit constructor

I would like to test if a Specified Method exists. And I have done the programmation with some help from this website. Yeah, I have written 2 interfaces and a class who implement the interfaces. Here are parts of the codes: public class TestMethod…
Esct
  • 133
  • 1
  • 2
  • 13
0
votes
2 answers

Is java 6 or 7 compiler improves str.startWith("a") and converts it into str.charAt(0) == 'a' if it contains string with one character?

Eclipse plugin PMD suggests me to use str.charAt(0) == 'a' instead of str.startWith("a") But I don't want to make code more complicated and I believe that java compilers are very smart and they improve performance of str.startWith("a") by…
Dmytro Plekhotkin
  • 1,965
  • 2
  • 23
  • 47
0
votes
2 answers

Restriction on J2SE inbuilt method

As per my company rule I can not use stop() of thread For that I want something like when I use stop(), eclipse should shows error/warning It is difficult to achieve by using checkstyle and PMD.
0
votes
3 answers

How to rewrite empty while block

I have instantiated a BufferedReader to read an input stream. It has a boolean ready() method that returns false until the reader can be read. Now I have BufferedReader br = new BufferedReader(new InputStreamReader(myProcess.getInputStream())); try…
András Hummer
  • 960
  • 1
  • 17
  • 35
0
votes
2 answers

Ads API: Implementing Partner Categories asks for account to be white listed. How to get white listed?

It seems that an account needs to be white listed somewhere to be able to use the new Partner Category feature. Anybody familiar with this? We tested with the account that is white listed for API access and get error back from Facebook with the…
Rian Smith
  • 363
  • 2
  • 4
  • 12
0
votes
1 answer

Why does PMD suggest making fields final?

I created Android application and run static analysis tool PMD on it. And what I don't get is why it is giving me warning and says to declare fields final when possible like in this example. final City selectedItem = (City)…
Bobans
  • 439
  • 6
  • 13
0
votes
1 answer

Pmd violations with sonar

I just need a clarification about PMD with Sonar.Can we reuse Pmd reportwhich is already produced by ant..Else sonar will dynamically produce its own violation using PMD. Please help me out...For past two days iam stucked up with this. Thanks!!!
Selwin
  • 11
  • 2
0
votes
1 answer

PMD rule for checking html/jsp files

I´d like to create a PMD rule that checks for a regex expression in any file (txt, html, jsp, etc.). The rule does not use Java or XPath structure. The idea is to read the file and add violations according to the line analyzed. I don´t know how to…
ad-rocha
0
votes
0 answers

maven-pmd-plugin external custom ruleset doesn't work

I'm using this in my pom in the reporting section: org.apache.maven.plugins maven-pmd-plugin 2.7.1
clausfod
  • 315
  • 1
  • 3
  • 7
0
votes
1 answer

maven pmd plugin reports no problems

I have configured the maven pmd plugin into a maven parent pom that I use with a test project called MFactors3. When I build this tiny project using m2Eclipse in Eclipse PMD reports a good number of violations. When I build the same project from…
Bob Rodini
  • 61
  • 5
0
votes
2 answers

COBOL Parser using javacc + PMD

I am using this grammar to generate a COBOL parser. I use javacc to generate the parser and Java Tree Builder to generate the AST from this grammar. I am customizing a eclipse plugin called PMD to read a COBOL file and generate the AST. There is a…
Marcio Barroso
  • 783
  • 1
  • 7
  • 21
0
votes
1 answer

PMD Eclipse run on file save

I am using eclipse Juno and its PMD plugin. How can I set my eclipse to run PMD on file save action? Thanks
amique
  • 2,176
  • 7
  • 34
  • 53
0
votes
1 answer

Unable to run PMD in STS 3.1.0 (uses Eclipse JUNO)

I installed Eclipse-pmd plugin in my STS 3.1.0. But the "PMD" option doesnt show up in my STS. couldnt run PMD.
Prabu
  • 101
  • 2
  • 7
0
votes
2 answers

Encoding ipv4 Address for use in Java

I'm using PMD to check java code, and I've run into the problem that states, "Do not hard code IPv4 or IPv6 addresses, even 127.0.0.1!" The IPv4 address I'm using is in fact just 127.0.0.1, and is only for testing purposes, but nonetheless I must…
TNC
  • 337
  • 2
  • 5
  • 17