pmd

What are the differences between PMD and FindBugs?

旧城冷巷雨未停 提交于 2019-11-29 18:54:26
There was a question comparing PMD and CheckStyle . However, I can't find a nice breakdown on the differences/similarities between PMD and FindBugs. I believe a key difference is that PMD works on source code, while FindBugs works on compiled bytecode files. But in terms of capabilities, should it be an either/or choice or do they complement each other? I'm using both. I think they complement each other. As you said, PMD works on source code and therefore finds problems like: violation of naming conventions, lack of curly braces, misplaced null check, long parameter list, unnecessary

PMD: Avoid instantiating new objects inside loops

假装没事ソ 提交于 2019-11-29 11:07:00
问题 I've got an issue with the PMD rule Avoid instantiating new objects inside loops . Here is some example code: import java.awt.Dimension; public class PMDDemo { public static void main(final String[] args) { final Dimension[] arr = new Dimension[10]; for (int i = 0; i < arr.length; i++) { arr[i] = new Dimension(i, i); // rule violation here } } } PMD gives me the above mentioned rule violation at the marked spot in the code. How am I supposed to create n instances of a class without creating

Unsupported @SuppressWarnings(“PMD.DoNotCallSystemExit”)

て烟熏妆下的殇ゞ 提交于 2019-11-29 10:33:32
问题 I need to use System.exit(0) in an application. Eclipse has the PMD plugin installed and complains about this line of code. Adding @SuppressWarnings ("PMD.DoNotCallSystemExit") remove that warning but now I get a warning that this SuppressWarnings is unsupported, despite the fact that it works. Is there a way to resolve this? 回答1: To get Eclipse to not flag the @SuppressWarnings("PMD") annotation, look under the menu headings Java -> Compiler -> Errors/Warnings -> Annotations -> Unhandled

自协商SGMII_IP核例化篇

陌路散爱 提交于 2019-11-29 04:18:30
自协商SGMII_IP核例化篇 前言 工程简介 前端IP核例化 速率和模式 核配置 Shared Logic Q0模块接口 后端IP核例化 核配置 Q1模块接口 顶层模块 异步FIFO 自协商 总结 前言 本篇主要介绍该IP核的“使用”,和实际项目工程,为下一篇的设计和板上调试做做准备工作,这个“使用”可不像BRAM、DSP核那么简单了,使用的过程中还是有很多坑要踩的;主要参考是该核的手册pg047,代码来源于生成的Example,不同的器件和软件版本可能会有差异,但影响不大。时间充裕的话,建议将整个文档都过一下,把官方的仿真跑一遍,不然,有可能会像我刚开始一样,因为理解不够,出现一些天真的想法。 工程简介 要做的事情是FPGA内部完成“(Bridge)桥梁”的作用,一方面通过PHY或者光模块将电口和光口的串行数据转换成并行,另一方面再将FPGA解析出的数据以SGMII总线发送给交换芯片,重点在跨时钟域处理和自协商内部的逻辑需要自己设计,为了脱敏,本篇不提供完整代码,主要放在思路和避坑。 前端IP核例化 光口与电口端,命名为Q0吧 速率和模式 从IP核的名字可以看出,该核通过配置可以生成两种核,光口可以用以太网PCS/PMA mode,电口具有PHY采用SGMII mode,这里速率采用1G,因为其内部有8b/10b转换,所以参考时钟则是125MHz

在解决了ORA-600 [2662]后,库启动的时候出现ORA-600[4193]错误

风流意气都作罢 提交于 2019-11-29 00:31:55
ORA-600[4193]解决 在解决了ORA-600 [2662]后,库启动的时候出现ORA-600[4193]错误 Tue Feb 14 09:34:11 2012 Errors in file d:\oracle\product\10.2.0\admin\interlib\bdump\interlib_smon_2784.trc: ORA-01595: error freeing extent (2) of rollback segment (3)) ORA-00607: Internal error occurred while making a change to a data block ORA-00600: internal error code, arguments: [4194], [6], [30], , , , , Tue Feb 14 09:35:34 2012 Errors in file d:\oracle\product\10.2.0\admin\interlib\udump\interlib_ora_2824.trc: ORA-00603: ORACLE server session terminated by fatal error ORA-00600: internal error code, arguments: [4193], [2005],

Unable to locate Source XRef to link to

…衆ロ難τιáo~ 提交于 2019-11-28 19:29:23
问题 I have a big maven project that uses the pmd plugin for code quality checks. since I started using the pmd plugin i get the following warning message: [WARNING] Unable to locate Source XRef to link to - DISABLED I googled and found that i need to implement the jxr plugin. so I add the following to the build property in the main pom.xml file. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jxr-plugin</artifactId> <version>2.3</version> </plugin> welp it doesn't really

Checkstyle vs. PMD

爱⌒轻易说出口 提交于 2019-11-28 15:17:19
We are introducing static analysis tools into the build system for our Java product. We are using Maven2 so Checkstyle and PMD integration come for free. However it looks like there is a large overlap in functionality between these two tools, in terms of enforcing basic style rules. Is there a benefit from utilizing both of these? I don't want to maintain 2 tools if one will work. If we choose one, which one should we use and why? We are also planning on using FindBugs. Are there other static analysis tools we should look at? Update: Consensus seems to be that PMD is preferred over CheckStyle.

Installing PMD 5.0.4 in Eclipse

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 12:20:00
Can anybody tell me how to install PMD in Eclipse. I have downloaded PMD 5.0.4 from the following link: http://sourceforge.net/projects/pmd/files/latest/download?source=files When I add this archive file in Eclipse install option I am getting an error stating that "It could not find the file specified". Just follow the directions on http://sourceforge.net/projects/pmd/files/pmd-eclipse/update-site/ I copied the direction here for you so you don't even have to click !! In Eclipse, click on Help -> Install New Software... Click on Add.. Enter the following: Name: PMD for Eclipse Update Site URL:

PMD violationSuppressXPath for all REST @GET methods?

元气小坏坏 提交于 2019-11-28 11:35:32
I am trying to narrow down the PMD rules, how can I exclude all REST methods which are annotated with @GET from PMD checks? 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']| /

Logger vs. System.out.println

早过忘川 提交于 2019-11-28 04:52:01
I'm using the PMD plugin for eclipse and it gives me an error when using System.out.println() with the explanation: System.(out|err).print is used, consider using a logger. My question is - What is a Logger? How is it used to print to the screen? Why is it better? matt b See this short introduction to log4j . The issue is in using System.out to print debugging or diagnostic information. It is a bad practice because you cannot easily change log levels, turn it off, customize it, etc. However if you are legitimately using System.out to print information to the user, then you can ignore this