Getting started with FindBugs-helping you reduce the number of bugs in your code

Source: Internet
Author: User

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

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.