http://maven.apache.org/plugins/maven-pmd-plugin/pmd-mojo.html#language There is no way currently to have it check for "jsp" as the source type without modifying the plugin. You might want to try maven-exec with direct command line options of PMD as short-cut. http://mojo.codehaus.org/exec-maven-plugin/ http:://pmd.sourceforge.net/pmd-5.2.1/usage/running.html...
I can think of only 2 reasons not to make a parameter final: to save the use of a local variable if you need to overwrite the parameter's value in some edge cases (this is the reason you pointed out) to save 6 characters per parameter (not a good enough...
This functionality is a bit hidden, but it exists. Go to "Window -> Preferences -> PMD -> Reports" and select the report format, you want, e.g. "text". Right-click on the project and select "PMD -> Check Code". Right-click on the project and select "PMD -> Generate Reports". Now, you should...
There seem to be two problems showing up. First, PMD doesn't handle the NoClassDefFoundError similar to ClassNotFoundException - I've created an issue for PMD here. Second, Sonar doesn't seem to provide the complete project classpath to PMD. In order for PMD to be able to take advantage of typeresolution, PMD...
I found the issue. There was an issue with Maven Plugin version 3.3 . Now I am using version 3.1 and the exact same code is working as expected.
The maven-pmd-plugin by default skips nowadays empty reports (property skipEmptyReport). You'll need to set this to false, to get in your site always a PMD/CPD report: <reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <version>3.4</version> <configuration> <skipEmptyReport>false</skipEmptyReport> </configuration> </plugin> </plugins> </reporting> This applies for both PMD and...
java,eclipse,eclipse-plugin,pmd
Try eclipse-pmd (available in the Eclipse marketplace or via the update site http://www.acanda.ch/eclipse-pmd/release/latest). With eclipse-pmd you can configure your projects to use a single rule set file for several projects. It also stores its path relative to the workspace. You still have to configure each project individually though (for now,...
If you want to exclude files from pmd checks your configuration should look something like this. The exclusions should be under the root of configuration not inside the rulesets tag. <configuration> <excludes> <exclude>.*/example/*.*</exclude> </excludes> </configuration> ...
This is not directly possible with maven. I'd recommend creating a custom ruleset file and reference this single ruleset in pom.xml instead. Custom Ruleset File: http://pmd.sourceforge.net/pmd-5.2.3/customizing/howtomakearuleset.html Example (filename custom-ruleset.xml): <?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...
sonarqube,checkstyle,pmd,code-quality
Have you enabled any PMD and Checkstyle rules in the Quality Profile you are using to analyse?
At last found the issue. I needed to resolve pmd and all it's transitive dependencies from a remote repo like Maven Central. repositories { mavenCentral() } pmd { toolVersion = "5.1.1" ignoreFailures = true } ...
java,eclipse,pmd,eclipse-kepler
I'm the creator of eclipse-pmd, the plugin you are trying to install. I tried to install it myself just now and it worked without any problems. So I can only guess what could be the problem in your case: The repository was temporarily not available Simply try again. You are...
This question is more a definition of what the software architect / technical lead wants. We have a common rule, what the quality of the tests have to be in the same quality as the code for production. But why? Since the test code is ensuring the quality of the...
See also the answer on the bug report #1339 and the changelog for 5.3.1: Language Java, ruleset design.xml: The rule “UseSingleton” has been renamed to “UseUtilityClass”. See also bugs #1059 and #1339. This is fixed with PMD 5.3.1 and later. For the time being, you'll need to manually fix the...
You can define a config file which includes the rulesets you wish to run. You can give this file as a parameter after the -R argument on the command line. An example file is here (MyRules.xml): <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <ruleset name="PMD.rul" 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>This ruleset was...
java,string,optimization,string-concatenation,pmd
Appending a character as a char will always be faster than appending it as a String. But does the performance difference matter? If you just do it once, it doesn't. If it is inside a cycle repeating its body a million times, then yes, it might matter. If you already...
Use a single LoC for this: return someCondition() ? "some value" : "some other value"; The code in here: String token; String authorization = getAuthorization(token); if (authorization != null) { String[] parts = authorization.split(" "); if (parts.length == 2 && "Bearer".equals(part[0])) { token = parts[1]; } return token; In this...
You can use your custom rule classes if you add your jar as an Eclipse plug-in fragment to your Eclipse installation. The host of the plug-in fragment must be ch.acanda.eclipse.pmd.core. To convert the jar to a plug-in fragment you have to modify the file MANIFEST.MF file and add a few...
Please, do not double post. Thread closed. Continuing at http://sonarqube.15.x6.nabble.com/Write-a-custom-XPath-task-that-looks-for-a-method-that-is-NOT-followed-by-a-chained-method-call-td5024017.html
We are using for example this rules to suppress checks on REST methods for final declaration. Maybe you need similar? <rule ref="rulesets/java/optimizations.xml/MethodArgumentCouldBeFinal"> <properties> <!-- Ignore Rest resources --> <property name="violationSuppressXPath" value=" //ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation//Name[@Image='GET'] | //ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation//Name[@Image='POST']|...
PMD has detected that jsarray_com is never reassigned, so it's suggesting to add final to the declaration to make this fact explicit. When you see final, you immediately know that jsarray_com will always reference the same object. It makes the code slightly easier to follow, but you are free to...
This turned out be because I was using an old version of the Maven PMD plugin. The Maven plugin pulls in PMD by itself, which is convenient, but doesn't give you any control over what version it pulls in. The version I was using, 2.7.1, pulled in PMD version 4.3,...
It is a standard that has been set so that people can easily read each other's code, therefore making code more maintainable. The quote below is from Oracle's website on Java code conventions: 80% of the lifetime cost of a piece of software goes to maintenance. Hardly any software is...