• Stars
    star
    143
  • Rank 256,039 (Top 6 %)
  • Language
    Java
  • License
    GNU Lesser Genera...
  • Created about 13 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a FindBugs/SpotBugs plugin for doing static code analysis for java code bases

fb-contrib

Build Status Open Source Helpers

a FindBugs and SpotBugs plugin for doing static code analysis on java byte code. For information see http://fb-contrib.sf.net

Available on maven.org

for FindBugs:

   GroupId: com.mebigfatguy.fb-contrib
ArtifactId: fb-contrib
   Version: 7.6.0

For SpotBugs

   GroupId: com.mebigfatguy.sb-contrib
ArtifactId: sb-contrib

Developer

  • Dave Brosius

Contributors

  • Bhaskar Maddala
  • Chris Peterson
  • Grzegorz Slowikowski
  • Trevor Pounds
  • Ronald Blaschke
  • Zenichi Amano
  • Philipp Wiesemann
  • Kevin Lubick
  • Philippe Arteau
  • Thrawn
  • Juan Martin Sotuyo Dodero
  • Richard Fearn
  • Mikkel Kjeldsen
  • Jeremy Landis
  • Peter Hermsdorf
  • David Burström
  • Venkata Gajavalli
  • Rubén López
  • Pavel Roskin

fb-contrib has two main branches, 'findbugs' and 'spotbugs'. Code is committed to findbugs, and then merged to spotbugs. It is preferable therefore to create merge requests against the findbugs branch. Thanks!

Setting up for Development - Ant

  1. Download/install Eclipse, ideally 4.3 (Kepler) or newer. The standard release (for Java) will work fine.
  2. Ant Dependencies Download yank, the dependency manager and bug-rank-check-style. Both jars (v1.2.0+ and v1.0.0+) should go in your ~/.ant/lib folder, which you will have to make if it doesn't exist. Windows people, this goes under [Username]/.ant/lib. Don't have more than one version of either jar in this folder, as it's not clear which one Ant will load, leading to annoying compatibility issues. This can be done using the ant target ant infra_jars
  3. Fork this git repo and clone it. GitHub for Windows or GitHub for Mac are good clients if you don't already have one.
  4. Open Eclipse. File>Import and then choose "Existing projects into workspace", and find the fb-contrib folder you created in step 3. Ignore any compile errors (for now).
  5. Using git, clone the FindBugs repository using git clone https://code.google.com/p/findbugs/ You will only need the findbugs subfolder (the one that has README.txt in it). You can delete the rest, if you wish.
  6. Import this project into Eclipse as well. You may wish to mark these files as read-only, so you modify the "correct" files.
  7. In the fb-contrib project, find the user.properties.example file. Make a copy of it named user.properties (this will not be tracked by version control). Modify the findbugs.dir property to where ever you have the FindBugs distribution installed. This is the executable FindBugs folder, not the source folder. The jar will be "installed" to (findbugs.dir)\plugin. For example, If you are using FindBugs with Eclipse (and you extracted Eclipse to C:\), you'll set this to something like findbugs.dir=/eclipse/plugins/edu.umd.cs.findbugs.plugin.eclipse_3.0.0.20140706-2cfb468
  8. Finally, build fb-contrib by finding the build.xml file in Eclipse, right-click it, and select Run As > Ant Build. The dependencies needed should be downloaded to fb-contrib/lib and the fb-contrib-VERSION.jar should be built.

Setting up for Development - Maven

  1. Download/install Maven, version 2.2.1 or newer.
  2. Clone the Git repository, as per step 3 above.
  3. Run mvn clean install in the fb-contrib directory.

Usage - Maven

To include the fb-contrib detectors when checking your project with FindBugs, you can use the FindBugs Maven plugin. The group ID for fb-contrib is com.mebigfatguy.fb-contrib, and the artifact ID is fb-contrib. Eg:

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>findbugs-maven-plugin</artifactId>
    <version>3.0.4</version>
    <configuration>
        <plugins>
            <plugin>
                <groupId>com.mebigfatguy.fb-contrib</groupId>
                <artifactId>fb-contrib</artifactId>
                <version>7.6.0</version>
            </plugin>
        </plugins>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Or to include the fb-contrib detectors when checking your project with Spotbugs, you can use the SpotBugs Maven plugin which is a fork of findbugs maven plugin to provide spotbugs integration. The group ID for sb-contrib is com.mebigfatguy.sb-contrib, and the artifact ID is sb-contrib. Eg:

<plugin>
    <groupId>com.github.spotbugs</groupId>
    <artifactId>spotbugs-maven-plugin</artifactId>
    <version>3.1.12</version>
    <configuration>
        <plugins>
            <plugin>
                <groupId>com.mebigfatguy.sb-contrib</groupId>
                <artifactId>sb-contrib</artifactId>
                <version>7.6.0</version>
            </plugin>
        </plugins>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>check</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Usage - Gradle

apply plugin: 'findbugs'

dependencies {
    // We need to manually set this first, or the plugin is not loaded
    findbugs 'com.google.code.findbugs:findbugs:3.0.0'
    findbugs configurations.findbugsPlugins.dependencies

    // To keep everything tidy, we set these apart
    findbugsPlugins 'com.mebigfatguy.fb-contrib:fb-contrib:7.6.0'
}

task findbugs(type: FindBugs) {
   // Add all your config here ...

   pluginClasspath = project.configurations.findbugsPlugins
}

Contributing

Once you have the dev environment set up, feel free to make changes and pull requests. Any edits are much appreciated, from finding typos, to adding examples in the messages, to creating new detectors, all help is welcome.

External guides for making detectors:

Misc references about bytecode:

For making detectors, it best to make several test cases, like those in the sample directory. Even better is if you can comment where you expect bug markers to appear and why, like this.

In your pull request, give an overview of your changes along with the related commits.

If you are not up for contributing code but notice a common problem with some third party library, or general purpose pattern, please add an issue too. We always like new ideas.

Often available on #fb-contrib on freenode.net for conversation.

More Repositories

1

apophysis-j

a fractal flame editor for electric sheep
Java
27
star
2

exagent

a javaagent to embellish exception stack traces with useful information
Java
10
star
3

hashshmash

An aspectj project for evaluating Hash Collection/hashCode() dispersement quality
Java
7
star
4

deadmethods

an ant task to find unused methods, regardless of access
Java
7
star
5

junitflood

A tool for creating unit tests through byte code inspection
Java
4
star
6

yank

a non transitive maven artifact fetcher for corporate environments
Java
3
star
7

fbaas

FindBugs as a Service
Java
2
star
8

stringb

An experimental StringBuilder alternative
Java
2
star
9

clytemnestra

A gui explorer for cassandra
Java
2
star
10

polycasso

An artwork generator using hillclimbing
Java
2
star
11

fb-contrib-cloud

A cloud implementation using MongoDB for FindBugs
Java
2
star
12

collatz4j

A visualization of the Collatz Conjecture
Java
2
star
13

jsr305

java annotations as specified by jsr305
Java
2
star
14

oahash

An open addressing hash implementation for Maps and Sets
Java
2
star
15

caveman

A small library containing standard collections using primitive types
Java
2
star
16

mongobrowser

A gui tool for browsing a mongo database
Java
2
star
17

borders4j

A collection of Swing Borders
Java
2
star
18

multifile

A file that allows the reading and writing of multiple streams. A file system in a file.
Java
2
star
19

2048playa

autononous 2048 player
Java
1
star
20

flickrcloud

a file storage tool that uses flickr
Java
1
star
21

neuron

Java
1
star
22

pixelle

A programmatic graphics editor
Java
1
star
23

swds

sample webdav server
Java
1
star
24

fuws

A very simple, lightweight http server.
Java
1
star
25

metrixagent

Java
1
star
26

loc4j

an ant task to count lines of code
Java
1
star
27

bzflag

C
1
star
28

classgraph

a visualization of class dependencies
Java
1
star
29

githublistener

a listener that stores github events into cassandra using cql3
Java
1
star
30

quiescence

an ant task to turn off all messages for a section of the build
Java
1
star
31

blocklist

An alternative java.util.List implementation that allows for better insert performance
Java
1
star
32

patchanim

A Bezier Patch animation tool
Java
1
star
33

ds

a declarative swing library
Java
1
star
34

jwa

A web application showing how to add the jamm java agent dynamically to a web app
Java
1
star
35

pickcal

A simple swing calendar picker gui under the Apache License
Java
1
star
36

stringliterals

A tool for parsing out all string literals used in a code base
Java
1
star
37

vcsversion

An ant task to provide revision, date and branch properties of the project for use in a build.xml
Java
1
star
38

baremetal4j

A java agent for allowing debugging at the byte code level from source debuggers (as in IDEs)
Java
1
star
39

inventory

an ant task to find why or why not jars are needed in ears/wars
Java
1
star
40

central4j

an api for accessing maven central
Java
1
star
41

rumors

A simple discovery/connection framework
Java
1
star
42

fbp-maven-plugin

a plugin that generates FindBugs project files (fbp) from a maven project
Java
1
star
43

damus

a prediction tool
Java
1
star
44

soos

A substitutable object output stream
Java
1
star
45

roomstore

an irc journaller using cassandra
Java
1
star
46

asm-delegate

A set of classes to be used with asm that allow for delegating visitors to a set of visitors.
Java
1
star
47

schemalizer

a schema inference tool
Java
1
star
48

fb-delta

A FindBugs report delta ant task
Java
1
star
49

gnomeminesplaya

Plays Gnome Mines
Java
1
star