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

Could not initialize class net.sourceforge.pmd.lang.xpath.Initializer

Here is my pmd script for ant build.xml
classicjonesynz
  • 4,012
  • 5
  • 38
  • 78
0
votes
1 answer

No ruleset or basic.xml in the sourceforge pmd-bin-5.0.0 download

I've been reading all over the PMD Website and it has all these references to but I cant find the file basic.xml in either the pmd-bin-5.0.0 or pmd-bin-5.0-alpha directory downloaded…
classicjonesynz
  • 4,012
  • 5
  • 38
  • 78
0
votes
1 answer

Is it possible to add a jar file to the ant class path from build.xml?

I want to add the PMD jar to the ant build but I want to check in the jar to source control so other developers do not have to modify their environment. Hence copying to the ant lib folder is not the ideal situation. Is there another way to add that…
Usman Ismail
  • 17,999
  • 14
  • 83
  • 165
0
votes
2 answers

PMD Eclipse copy paste tool, check just one class

I'm using PMD tool and I can check at project level for "Find Suspect Copy & Paste". The problem is, I just want to check on class. Does anyone know of a way to check just one class? I can do the check for violations on one class fine, but not the…
David
  • 19,577
  • 28
  • 108
  • 128
0
votes
0 answers

Running customized PMD ruleset in Maven

I would like to run my customized pmd rule set which is in my local disk D:\rulesets\java. I am using maven to build my application. I put the below entry in maven POM.xml
Mohan
  • 3,893
  • 9
  • 33
  • 42
0
votes
1 answer

Using PMD default rules with properties

How to use the dafault rules with properties in PMD. Now I'm using the default rules as this works fine but the rules like "NPathComplexity" in Codesize use properties so that we can…
Anandhakrishnan
  • 548
  • 2
  • 7
  • 21
0
votes
1 answer

Adding pmd task to build.xml using Ant

I am new to Ant.I have created one ant task for generating pmd on the basis of ruleset.xml.Below code is not working, when i do ant pmd..i want to know whether any problem with this code.. whether toFile should be entire path(D:\Jenkins) or one the…
varghese
  • 131
  • 1
  • 4
  • 12
0
votes
1 answer

Custom XPath rule raises violation in pmd but not in sonar

I have a quite strange behavior. I create a XPath rule for PMD 4.2.6 in a file named pmd-extensions.xml : ...
0
votes
1 answer

Why : A PMD rule without 'ref' attribute can't be imported. see 'null'?

I'm trying to create a quality profile in Sonar 3.0.1 and to specify my pmd configuration file. But when I submit it, I've got the following error : A PMD rule without 'ref' attribute can't be imported. see 'null' Here the content of my extension…
0
votes
2 answers

Custom PMD rule not being highlighted by PMD Eclipse plugin

I'm trying to create a custom rule that flags up the use of return statements in void methods, for example: public class MyClass { public void myMethod(Object someObj) { if (someObj == null) { return; } …
0
votes
2 answers

PMD: how to deal with no need to check null before instanceof

Hi i have the following code. if (SecurityContextHolder.getContext().getAuthentication() != null && SecurityContextHolder.getContext().getAuthentication() .getPrincipal() instanceof User) When I check with…
Chun ping Wang
  • 3,879
  • 12
  • 42
  • 53
0
votes
1 answer

PMD xpath tutorials

I'm about to write custom rules for my Java EE codebase, Can anyone help where to begin for writing xpath rules? Is there any complete tutorial available for this?
Anandhakrishnan
  • 548
  • 2
  • 7
  • 21
0
votes
2 answers

Final variables

Possible Duplicate: Why would one mark local variables and method parameters as “final” in Java? I used PMD in my code and it always tells me to make method local variables final. Can someone tell me how this effects the general performance apart…
Madz
  • 1,273
  • 2
  • 18
  • 35
-1
votes
0 answers

Finding duplicate blocks of code across multiple files

How can I- using vscode/unix- find duplicates of code blocks (text blocks) across several files? I would like the output to be in JSON format.
gabbi
  • 108
  • 9
-1
votes
1 answer

Is SonarQube sufficient for static code reviews?

My applications are based on Java, Kotlin and React. Besides SonarQube there are other popular tools like: Amazon CodeGuru helps you improve code quality and automate code reviews by scanning and profiling Java and Python applications. CodeGuru…