##fb-contrib Eclipse quick fix plugin (fb-contrib quickfixes, for short) ## This repository extends the quick-fixes offered by the FindBugs Eclipse Plugin to cover the bugs detected by fb-contrib, Find Security Bugs and FindBugs itself.
##Installing the plugin## To install this project, open Eclipse, go to Help>Install New Software, and copy in the following link:
You must have Findbugs Eclipse Plugin version 3.0.1 (released March 6, 2015) or newer. If you don't, the Eclipse installer will try to install it for you.
Fb-contrib quickfixes has been tested on Eclipe Kepler and Luna.
Find Security Bugs
##Setting up the project for development##
- Download/install Eclipse Luna (4.4) or newer. The Eclipse for RCP and RAP Developers will work fine.
- Install findbugs-eclipse-plugin-3.0.1 from the main FindBugs page. You may also just install fb-contrib-eclipse-quickfixes and have the findbugs plugin be auto-installed.
- Clone findbugs :
git clone https://code.google.com/p/findbugs/GitHub for Windows or GitHub for Mac are good clients if you don't already have one. There are a lot of folders and projects associated with the root project, but you only need the
findbugs. You may optionally include the
- Open Eclipse. File>Import and then choose "Existing projects into workspace", and find the
findbugsproject (not the root project) you just cloned. You may have to run the build.xml in
findBugsEclipsePluginto get the lib jars copied over, if you imported that project as well.
- Clone and import fb-contrib into Eclipse. Follow the readme to get it setup to build.
- Build fb-contrib by running the ant script
fb-contrib-6.1.0.jar(or later) to
[Eclipse folder]\plugins\edu.umd.cs.findbugs.plugin.eclipse_220.127.116.1140817-dd3f35c\pluginwhere [Eclipse folder] is wherever you installed/extracted Eclipse to.
- Fork/Clone this git repo. Import this project into Eclipse. You should have now imported 3 or 4 projects,
findBugsEclipsePlugin. There should be no compile errors.
###Deploying fb-contrib quickfixes from Eclipse###
There are two default Run Configurations for Eclipse. If you don't see the included Launch Configurations under the green Run button, you may need to refresh the projects, or browse Run Configurations. Launch 3.x was tested on Indigo and Launch 4.x was tested on Kepler and Luna. Don't run either yet.
Make sure the desired Run Configuration is setup such that both findbugs plugins are selected under Target Platform. If you installed the compiled fb-contrib-eclipse-plugin, make sure only the version under Workspace is selected, else you may wonder why your features don't show up.
You will be able to run either Fb-Contrib-Eclipse configuration.
###Building the project as an update site to deploy###
Make a copy of local.properties.example and name it
local.properties. In that file, point 'build.eclipse.dir' to a clean Eclipse (Luna) installation that you want to use to build the plugin. You may also update
test.eclipse.dirto point to a clean Eclipse installation that you want to use to test, which can be an older version if you want. I build with Luna and test on Kepler on my local machine. Travis CI uses Luna for both stages.
Run build.xml as an Ant Build, which should build and create a p2 update site under ./output-site.
###Running unit tests from Ant###
test-headless target in build.xml. Assuming your local.properties are setup (as above), it should fire up an instance of Eclipse and run the tests.
###Troubleshooting dev environment setup###
Execute failed: java.io.IOException: Cannot run program "git": Assuming you have installed git, you may have to add git to your External Tools Configurations
###Development notes### This project comes with a preconfigured Eclipse formatter setting. These are the same settings used in the FindBugs Eclipse project. Try not to mix feature additions with formatting corrections - make a standalone "Formatting" commit.
Additionally, the launch configuration will use the workspace version of fb-contrib, but the installed version of the FindBugs Eclipse Plugin. You can easily make a launch configuration that uses the version from your workspace if you want.
Unit tests are encouraged. Write some buggy code (preferably sticking to one family of bugs), place it in classesToFix and a fixed version in fixedClasses. Then, add a test case to TestContributedQuickFix.java - look at the other test cases for examples of how to use the high-level assertion TestHarness.
To run the tests, you'll need to find rt.jar from your JAVA_HOME/lib and copy it to testResources. For Java 1.7, name it rt17.jar, for Java 1.8, rt18.jar, and so on. This allows the test code to compile.
##License## FindBugs, the FindBugs Eclipse plugin, fb-contrib, Find Security Bugs, are all released under the LGPL license. This project relies on the compiled, released versions of each of those libraries. These libraries, and their source code, can be found by following the links provided.
Some small pieces of the testing framework are redistributed (having been modified) under the Eclipse Public License. Those source files have links to the originals.
This project, where not otherwise specified, is released under the MIT license. It's a very loose license, allowing liberal reuse/modification.