pmd

Hudson/Jenkins PMD Configuration

末鹿安然 提交于 2019-12-12 14:11:27
问题 I am new to Jenkins and just started configuring it. This is what i have done till now: Installed and configured Jenkins to display the home page. Added PMD plugin. Set the HUDSON_HOME to a specific directory > C:\Work\Jenkins Configured a test build to run a simple do-nothing ant script. It runs successfully Written an independent pmdbuild.xml to run checks on a set of files in C:\myview (I am using clearcase). This xml also copies the output pmd_results.xml to the workspace directory in

How to tell PMD to ignore @PostConstruct Methods for unused Code

吃可爱长大的小学妹 提交于 2019-12-12 11:39:36
问题 we have a project which is checked by PMD for violations of e.g. unused private methods. Our problem is that we don't know if it is possible to ignore private Methods which are annotated with @PostConstruct . The rule is defined as following: <rule ref="rulesets/java/unusedcode.xml/UnusedPrivateMethod"/> Edit: My goal is to define it once to ignore annotated methods. I would like to prevent writing @SupressWarnings on every method. 回答1: With the hint and advice from HairyFotr i was able to

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

六月ゝ 毕业季﹏ 提交于 2019-12-12 02:16:20
问题 I've been reading all over the PMD Website and it has all these references to <rule ref="rulesets/basic.xml/UnnecessaryConversionTemporary"/> but I cant find the file basic.xml in either the pmd-bin-5.0.0 or pmd-bin-5.0-alpha directory downloaded from sourceforge. As you can see in the screen dump I've provided below, I've done a search for this basic.xml and came up empty handed. (source: iforce.co.nz) In the next screen shot of pmd-bin-5.0.0 there is no folder called ruleset (source: iforce

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

元气小坏坏 提交于 2019-12-11 23:15:48
问题 Here is my pmd script for ant build.xml <property name="pmd.dir" value="${basedir}/pmd" /><!-- directory that contains pmd.jar --> <property name="pmd.test.results" location="${build.dir}/pmd"/> <path id="pmd.lib" > <fileset dir="${pmd.dir}"> <include name="*.jar"/> <exclude name="/rulesets" /> </fileset> </path> <target name="pmd" depends="compile" > <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.lib"/> <pmd shortFilenames="true"> <ruleset>b</ruleset>

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

风流意气都作罢 提交于 2019-12-11 16:52:36
问题 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 file (sample taken at Sonar site) : <rules> <rule key="AvoidIfWithoutBrace"> <name>Avoid if without using brace</name> <configKey>rulesets/extensions.xml/AvoidIfWithoutBrace</configKey> <category name="Usability" /> <description>éviter les if sans

Pmd violations with sonar

北城余情 提交于 2019-12-11 16:49:17
问题 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!!! 回答1: No it's not possible to import PMD nor Checkstyle reports. This is not the philosophy of Sonar. Nothing guarantees that PMD has been executed with the configuration (Quality Profile) declared in sonar. It would lead to inconsistent results.

Error while installing PMD in eclipse

谁说胖子不能爱 提交于 2019-12-11 16:27:36
问题 While installing PMD in eclipse Luna, i am getting some error like could not find jar even after jar is inside the zip file. what i ve done is, downloaded the zip file of PMD eclipse file from http://sourceforge.net/projects/pmd/files/latest/download?source=files and in eclipse > Help > install new software > 回答1: To install the PMD for Eclipse plugin: In Eclipse, click on Help -> Install New Software... Click on Add.. Enter the following: Name: PMD for Eclipse Update Site URL: https:/

Ensure that fields with specific annotations are 'private'

自作多情 提交于 2019-12-11 11:53:42
问题 Very common mistake in our code is to write @Mock Object object; @InjectMocks Subject subject; instead of @Mock private Object object; @InjectMocks private Subject subject; This prevents PMD/FindBugs/IntelliJ from issuing warning when the field becomes unused and also our code reviews are bloated with "make this field private" comments. Is there any static-analysis rule in any tool to warn when fields with specific annotations do not have expected visibility? I found Checkstyle's

PMD violation : Use explicit scoping instead of the default package private level

爷,独闯天下 提交于 2019-12-11 09:36:09
问题 I just begin to use PMD. I can't fix in my code PMD violation : "Use explicit scoping instead of the default package private level". It appears on these places in my code: String carName = ""; //car name String carSize = ""; //car size String carColor = "";//car color ArrayList<Car> carList = new ArrayList(); static MyLog log = new MyLog(); //log How to fix it? 回答1: With regards to explicit scoping, make your fields private to enforce encapsulation 来源: https://stackoverflow.com/questions

Identifying Connection not closed in java code using PMD

你说的曾经没有我的故事 提交于 2019-12-11 08:48:52
问题 For identifying connection leaks in code, i'm using PMD. Now with PMD, it will identify all collection leaks and show the following error, if it didn't find connection.close(). C:\raghu\Harmony\branch\GlobalSKUPhase1A\source\Java\DataLoadServiceApp\src\dell\harmony\data\JdoServer.java:861: Ensure that resources like this Connection object are closed after use However, with our project code, we also use many customized connection close, i.e) instead of using connection.close(), we call a