FindBugs Getting Started
FindBugs effect
After developers have developed some of the code, they can use findbugs to check for code flaws. Improve the quality of the code, but also reduce the number of bugs that testers have reported to you.
Code Defect Classification
Depending on the nature of the defect, it can be broadly divided into the following categories
· Bad practice.
· Correctness may not be correct
· Dodgy code bad codes
· Experimental experiment
· Internationalization internationalization
· Malicious Code vulnerility Malware Vulnerability
· Multithreaded correctness multithreading problems
· Performance Performance Issues
Some examples are also given on the official website of FindBugs:
Http://findbugs.sourceforge.net/bugDescriptions.html
How to use FindBugs?
There are 3 ways to use FindBugs: 1) using the GUI,
2) The role of the IDE's plug-in use, 3) is used in the ant script.
Let's talk about the first two ways of using:
1) using the FindBugs GUI
1.1 Download
:
Linux:http://prdownloads.sourceforge.net/findbugs/findbugs-3.0.1.tar.gz?download
Windows:
Http://prdownloads.sourceforge.net/findbugs/findbugs-3.0.1.zip?download
1.2 installation
Installation method is very simple, only with decompression. Configure the environment variable findbugs_home after installation.
Linux:export findbugs_home=/home/username/findbugs
Windows:
1.3 Start
Directory switch to Findbugs/bin directory:
CD $findbugs _home/bin or CD%findbugs_home%/bin
Run the FindBugs script:
./findbugs or Findbugs.bat
This will enable the FindBugs GUI to start:
Description
• The class package and directory to be analyzed, typically the classes package to be analyzed
• Helper classes are dependent jar packages, etc.
• Source file directory is the source directory
2) use as IDE plugin
Developers often use this approach. The supported Ides are: Eclipse, NetBeans, Intellij Ieda.
Let's talk about how to use it in eclipse.
Download Plugin
:
http://sourceforge.net/projects/findbugs/files/findbugs%20eclipse%20plugin/
Installation
Just unzip it into the Eclipse/plugins directory.
Filter configuration
Open Eclipse's perferences configuration:
Analysis Bugs:
Getting started with FindBugs-helping you reduce the number of bugs in your code