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
-1
votes
1 answer

How do I create a custom PMD rule to check if an instance of DSLContext is begin referenced in a loop?

I am trying to create a custom PMD rule that will cause a violation if an instance of org.jooq.DSLContext is being referenced in a loop. I am completely new to PMD so I have no idea where to start. Can anyone help?
-1
votes
2 answers

Static Analysis tool to catch self-invocation bypassing Spring cache @Cacheable method

I understand that this is because of the way proxies are created for handling caching, transaction related functionality in Spring. And the way to fix it is use AspectJ but I donot want to take that route cause it has its own problems. Can I detect…
Sabya
  • 197
  • 4
  • 17
-1
votes
1 answer

Two-tiered rulesets in PMD Gradle plugin

I want to set up PMD in my gradle project to have two rulesets, one that's mandatory and breaks builds, and one that just reports but lets the build continue. Is this possible?
-1
votes
1 answer

Parsing a JSON file with PHP

I'm trying to get data from the following JSON file using PHP. I specifically want the @name and additional parameters in the below hierarchy, parsed and put in a tabular format which can be easily read as html. Considering we may be many types and…
-1
votes
1 answer

Unable to add codesniffer, psr-1, psr-2, pmd rules in sonarqube

Need to add codesniffer, psr-1, psr-2, pmd rules in sonarqube. I tried finding plugin but get sonar-php-codesniffer0.2 plugin which is compatible only upto sonarqube>2.0. Also there is no way to import custom php rules in sonarqube6.1 or updated…
YATIN GUPTA
  • 916
  • 9
  • 17
-1
votes
1 answer

Can PMD be used for dataflow analysis on Java?

i'd like to know if i can use PMD to perform some basic data flow analysis actions. It's an assignment so it doesn't matter if it's trivial. I can't find any code examples online. Is the DFA module working? Should i go the reverse engineering way…
alextsil
  • 504
  • 3
  • 11
  • 26
-1
votes
2 answers

Get warnings from PMD with Jenkins Pipeline

How get number of warnings from PMD with Jenkins Pipeline?. I have tried but can not find a way to fix this
JuanG
  • 1
  • 1
-1
votes
1 answer

pmd:NullAssignment not valid for methods?

There is no assignment in the below code example. I think that this rule should not apply to this code. My setup: SonarQube 4.5.4 LTS PMD plugin 2.3
Alix
  • 2,630
  • 30
  • 72
-1
votes
1 answer

How to achieve hard-code voilations with CodePro?

I have to check some voilations like this if(emp.companyName="MyCompany") ie. Here there should not "MyComapany" hard-code in expression or condition checking. which rule of CodePro do this.
Sun
  • 3,444
  • 7
  • 53
  • 83
-1
votes
1 answer

what is the internal working of code quality check tools?

On which principal do the code quality check tools work? For example PMD, FindBugs, CheckStyle etc. Do they use some kind of computer science principals?
Sam
  • 2,352
  • 4
  • 32
  • 45
-1
votes
1 answer

Skip Maven Flex PMD

We are looking for an option in flex-pmd-maven-plugin to skip the pmd execution temporarily using a command-line option. The maven pmd plugin has a -Dpmd.skip=true option. I am looking for a similar kind of thing for flex-pmd-maven-plugin too. …
-2
votes
1 answer

Avoid the use of value in annotations when its the only element

"UnnecessaryAnnotationValueElement: Avoid the use of value in annotations when its the only element" @Query(value = "SELECT t FROM IntraPaymentTransaction t WHERE exchangeBuyAmount.currency <> exchangeSellAmount.currency") I use this query in my…
ali
  • 9
  • 2
-2
votes
1 answer

PMD refactoring code

I am using latest PMD on a Java project to achieve dead code elimination. I used this rule UnusedLocalVariable and it worked perfectly producing as output the unused local variables. Is there any way to apply those findings directly in the code,…
sid
  • 1
  • 1
-2
votes
3 answers

Checkstyle : Why as a developer we should worry about it?

I am not sure whether it is right forum or not. I just want to ask, what is there in checkstyle for developer. PMD is useful because it improve our coding skills but checkstyle I am not sure. Some checkstyle warning are too restrict like you can…
sauumum
  • 1,638
  • 1
  • 19
  • 36
-3
votes
1 answer

Why should we avoid nested blocks of code to be empty?

Most of the time a block of code is empty when a piece of code is really missing. So such empty block must be either filled or removed. What is the reason to do so? How does leaving the block empty affect the compilation? For example: for (int i =…
Praveen Dinks
  • 21
  • 1
  • 4
1 2 3
57
58