pmd

PMD plugin fails after upgrading Sonarqube to 4.5.4

守給你的承諾、 提交于 2019-12-24 04:08:33
问题 I am upgrading my existing SonarQube 3.7.4 installation to the new LTS release 4.5.4 . I'd like to reuse my ruleset and I am using the sonarqube ant task (as before) to analyze my projects. After upgrading the sonar installation and the ant task to 2.2 without changing anything else I'm getting a NoClassDefFoundError while executing the ant task: build.xml:1659: org.sonar.runner.impl.RunnerException: Unable to execute Sonar at org.sonar.runner.impl.BatchLauncher$1.delegateExecution

Eclipse pmd plug-in handshake failure

大城市里の小女人 提交于 2019-12-24 02:57:14
问题 I'm trying to add eclipse pmd plug-in ended up with the following error. Unable to read repository at https://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/content.xml. Received fatal alert: handshake_failure Any idea what's wrong ? 回答1: It's probably one of the following two cases: Either the cipher is not supported by your JRE - see answer https://stackoverflow.com/a/42129608/1169968 to install the JCE security patch to allow unlimited security (local_policy.jar and US_export

Maven pmd plugin - Exclude/Disable a rule

巧了我就是萌 提交于 2019-12-23 10:15:12
问题 I'm attempting to exclude a certain rule from pmd using the maven-pmd-plugin (in a multi-module maven project). Approach: Using the excludeFromFailureFile http://maven.apache.org/plugins/maven-pmd-plugin/examples/violation-exclusions.html Ideally, I want to exclude this rule for the entire product (based on a parent package), however,to being with I tested for a particular class - even that is not working. Environment Java 7, Maven 3.0.3 <plugin> <groupId>org.apache.maven.plugins</groupId>

@SuppressWarnings more than one rule not working

♀尐吖头ヾ 提交于 2019-12-23 10:14:16
问题 PMD and SonarQube a nice tools but I have problems trying to suppress PMD warnings. We use Lombok a lot in our project, so many of the model classes have a: @SuppressWarnings("PMD.UnusedPrivateField") as an class-level annotations. This works fine. The problem is, that if I wan't to ignore one more rule, I would expect the following syntax: @SuppressWarnings(value = { "PMD.UnusedPrivateField", "PMD.SingularField" }) This looks like the correct syntax, also reading the implementation of the

配置sonar和jenkins进行代码审查

柔情痞子 提交于 2019-12-23 06:31:07
转自: http://www.cnblogs.com/gao241/p/3190701.html, 版权归原作者所有。 本文以CentOS操作系统为例介绍Sonar的安装配置,以及如何与Jenkins进行集成,通过pmd-cpd、checkstyle、findbugs等工具对代码进行持续审查。 一、安装配置sonar 1、Sonar介绍 Sonar是一个用于代码质量管理的开源平台,用于管理Java源代码的质量。通过插件机制,Sonar 可以集成不同的测试工具,代码分析工具,以及持续集成工具,比如pmd-cpd、checkstyle、findbugs、Jenkins。通过不同的插件对这些结果进行再加工处理,通过量化的方式度量代码质量的变化,从而可以方便地对不同规模和种类的工程进行代码质量管理。 同时 Sonar 还对大量的持续集成工具提供了接口支持,可以很方便地在持续集成中使用 Sonar。 此外,Sonar 的插件还可以对 Java 以外的其他编程语言提供支持,对国际化以及报告文档化也有良好的支持。 2、配置数据库 Apache Derby 是Sonar自带并且默认安装使用的数据库,此外Sonar对如下数据库提供支持:MySQL 5.x, Oracle 10g XE, Postgresql, MS SqlServer等,本文以mysql为例介绍如何配置数据库: 1)创建数据库

Is there any Checkstyle/PMD/Findbugs rule to force “else if” to be on the same line?

烈酒焚心 提交于 2019-12-22 06:03:08
问题 In our project for chained if/else/if we would like to have following formatting: if (flag1) { // Do something 1 } else if (flag2) { // Do something 2 } else if (flag3) { // Do something 3 } And forbid following one: if (flag1) { // Do something 1 } else { if (flag2) { // Do something 2 } else { if (flag3) { // Do something 3 } } } Is there some predefined rule in either of listed above static code analysis tools to force this code style? If no - I know there is an ability to write custom

Add an empty string vs toString - why is it bad?

二次信任 提交于 2019-12-22 04:58:31
问题 According to the tool PMD, the following is a bad practice: String s = "" + 123; // bad String t = Integer.toString(456); // ok This is an inefficient way to convert any type to a `String`. Why is it a bad thing to do? 回答1: String s = "" + 123; // bad String t = Integer.toString(456); Will be compiled to: String s = "123"; String t = Integer.toString(456); so: "" +123 is obvious slightly better! Checked with JAD public static void main(String args[]) { // 0 0:ldc1 #16 <String "123"> // 1 2

Which is the highest priority in PMD?

爷,独闯天下 提交于 2019-12-22 04:32:45
问题 Maybe it's just me, but I can't find information which is the highest priority in PMD: 1 or 5 ? Because of http://pmd.sourceforge.net/running.html and the mention of the command line parameter -minimumpriority I think 5 is the highest and 1 is the lowest value. Am I right? 回答1: Actually 1 is highest priority and 5 is lowest priority. You can check the exported rule set, where <rule ref="rulesets/imports.xml/ImportFromSamePackage"/> <!-- Default --> <rule ref="rulesets/imports.xml

Which is the highest priority in PMD?

大憨熊 提交于 2019-12-22 04:32:13
问题 Maybe it's just me, but I can't find information which is the highest priority in PMD: 1 or 5 ? Because of http://pmd.sourceforge.net/running.html and the mention of the command line parameter -minimumpriority I think 5 is the highest and 1 is the lowest value. Am I right? 回答1: Actually 1 is highest priority and 5 is lowest priority. You can check the exported rule set, where <rule ref="rulesets/imports.xml/ImportFromSamePackage"/> <!-- Default --> <rule ref="rulesets/imports.xml

How to Add custom JAR to the “eclipse-pmd” plugin?

做~自己de王妃 提交于 2019-12-21 20:15:26
问题 Installed the Eclipse PMD plugin (written by Philip Graf ) from here. I tried to associate a custom PMD rule classes JAR but couldn't find a provision for it. This JAR contains custom rule classes (that extends AbstractJavaRule indirectly). So is there any way to configure eclipse-pmd plugin to accept this custom JAR? My custompmd.jar has this structure: custompmd.jar └─com/pmd/custom └─AvoidHardcodingRule.class └─AvoidCatchWithoutLogErrorRule.class └─etc... Simply putting it in plugins