Tags: findbugsDescribed earlier jenkins+gerrit+git build CI system, in fact, there are many useful plug-ins in CI system, these plug-ins can help developers to find the code in the bug or non-standard place. The following is the introduction of CI-related plug-ins
FindBugs: FindBugs is a static analysis tool that examines a class or JAR file to compare bytecode with a set of defect patterns to identify possible problems. With the static analysis tool, you can analyze the
ArticleDirectory
E: \ SRC \ confirmratelimitactivity
I didn't know about PMD before. I recently heard about PC lint before I started to get in touch with it. If such a good tool is used, it can help me a lot better.CodeHabits and norms are of great help ~
Let's see how he works.
Many companies use PC lint as a static code review tool for C/C ++. It is said that Microsoft regards PC lint review with no errors or warnings as the firs
Java advanced (iv) ------ java programming specifications --- installation of FindBugs, PMD, and CheckStyle code quality detection tools
Here, the plug-in is used to install FindBugs, PMD, and CheckStyle for myeclipse.
You can search for checkstyle, pmd, and findbugs to find their corresponding plug-ins.
There are three installation methods for plug-ins. I
Before formally entering the test, it is helpful to do some static code analysis and code review to improve the quality and the system, the above is the data proofPMD It is a Java source code parser based on a static rule set that identifies potential problems such as:– Possible bug--empty try/catch/finally/switch blocks.– Useless codes (Dead code): Useless local variables, method arguments, and private methods.– An empty If/while statement.– Overly complex expressions-unnecessary if statements,
website to download the latest version findbugs http://findbugs.sourceforge.net/downloads.html, download and unzip, and then copy the Unzip folder to the Eclipse installation directory ( My Eclipse installation directory d:\ Software installation \eclipse\eclipse) under Plugins directory:(ii) Use:(1) Write a program with the wrong Java code, test it,(2) Right click on the source file, select Findbugs-->find Bugs (for example):A Bugs Two warnings icon
PMD and Checkstyle
Depending on the PMD document, it checks the following sections in your code:
Unused local variablesAn empty catch blockParameter not usedEmpty if statementDuplicate import statementUnused private methodsCould be a singletons class.Short/Long variable and method nameCheckstyle Check the following sections:
Javadoc annotationNaming conventionsTitleImport statementVolume sizeBlankModifiersB
Before formally entering the test, it is helpful to do some static code analysis and code review to improve the quality and the system, the above is the data proofPMD It is a Java source code parser based on a static rule set that identifies potential problems such as:– Possible bug--empty try/catch/finally/switch blocks.– Useless codes (Dead code): Useless local variables, method arguments, and private methods.– An empty If/while statement.– Overly complex expressions-unnecessary if statements,
When people talk about the code rule engine. Everyone likes to stand on their own and say that they prefer tools, rather than other tools.
For instance, a PMD supporter cocould say:
"Checkstyle is a stupid tool consuming time to search for tab characters when PMD is a smart one that can do the job alone as a good soldier, findbugs is very good for resource consumption and Macer is... Uh, what is Macer? "
Ti
Java advanced (iii) ------ java programming specifications-Comparison of FindBugs, PMD, and CheckStyle code quality detection tools
In the previous article, we have learned how to automatically set the code format in myeclipse.
During the development process, we will find that we do not have much time to perform code check and review. However, we can use tools to automatically check the code to improve work efficiency. FindBugs,
Today again want to start Java Code Static Detection Tool utilization problem, mainly try to use PMD again, found a lot of code coding problems and good code recommendations, and learned a lot of their own prior to the Java convenient basic knowledge, feel very good, the relevant understanding of the good rules of the recollection summary, In the future coding process to be ready to use the Code static Check tool, with good code static check tool habi
PMD ErrorAvoid autogenerated methods to access private fields and methods of inner / outer classesSample Examplepublic class Test { public static void main(final String[] args) { //code } public void test(){ Executors.newSingleThreadExecutor().execute(new Thread() { @Override public void run() { final int a = getNum(); System.out.println(a); } }); } priv
PMD is an excellent tool for code checking of Java programs. It can check whether the Java code contains unused variables, whether they contain empty fetch blocks, whether they contain unnecessary objects, and so on.But in the course of use, you will find that there are a lot of error and warning in the PMD plugin, although PMD encourages programmers to improve t
leadership support, the project members are good response is difficult to say, if we all like to improve more inspection is not too late.
In fact, a dependent detection, but now the project is using the SSH architecture, the existing dependency checking tool, the support for spring is not very good, and then give up.
For the choice of tools, tight is familiar with the choice of Checkstyle, FindBugs and PMD CPD tools.
three. Expected results:
Use th
Read and display of models in PMD format
It has been May, and it took more than ten days to study the results. Write a log to commemorate it.It is a three-dimensional model format and is mainly used in mikumikudance and pmdeditor. There are fewer descriptions about the format, so my research mainly involves the MMD library of itsuhane.The PMD format file is also a simple binary file, because the file form
The PMD plugin installation address is: Http://pmd.sourceforge.net/eclipse
After the PMD plug-in is installed, it consists of 2 parts: CPD and PMD.
CPD is used to check for repetitive code (for example, by copying and pasting the resulting code)
Use it very simply, right click on your item, select Find suspect cut and Paste:
Then select the language and out
Put my latest updated MyEclipse2014 integrated PMD code detection plug-in custom rule profile Java version released, to facilitate their future review, but also to see if they can help to have this need of small partners. FileName: cplatform_pmd5.2.3_rules.xml
1. After installation start Jenkins, in Manage Jenkins, select Manage plugin, install related available in Plugins tab
FindBugs Plug-inThis plug-in collects the FindBugs analysis results of the project modules and visualizes found.If you like this open source plug-in consider supporting I work by buying my Android game Inca.Jenkins Cobertura PluginThis is plugin integrates Cobertura coverage reports to Jenkins.PMD Plug-inThis is plug-in collects the PMD
1. Use of MVN Checkstyle plugin
You can get Checkstyle reports on target/site/checkstyle.html and target/without any setup, directly running MVN checkstyle:checkstyle Checkstyle-result.xml. The check rule for the Checkstyle used is Sun_checks.xml-sun Microsystems Definition (default).
If you want to use custom rules, the version above maven3.0 needs to be added under the Pom.xml
And it should be
The above is for a single module project.
For project with multiple module, you need to make a
When people talk about code rule engines. Everyone likes to stand in his place and say what he prefers, and reject other tools.
For instance, a PMD supporter could say:"Checkstyle is a stupid tool consuming time to search for tab characters when PMD is a smart one," can do the job alone As a good soldier, Findbugs is very good for resource consumption and macker are ... uh, what is Macker? “Time to breathe!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.