Configuring FindBugs

It is possible to incorporate FindBugs results in the TICS output for JAVA files. FindBugs is free software, distributed under the terms of the Lesser GNU Public License

Which FindBugs version should be used

The integration of FindBugs within TICS is based on FindBugs version 1.3.7. This version is downloadable via the TICS download site. It is not recommended to use another version than this version.

Prerequisites

For a successful FindBugs integration, the following prerequisites must be met:

Basic configuration

Since Findbugs acts on the classfiles of a project, it needs to be instructed with several options, like the classpath for the project. This information is extracted by TICS from the project's build. Currently, for JAVA only the BUILDTYPE Ant is supported by TICS. Since no preprocessing has to be performed, the compiler None should be specified for the Ant buildtype.

  'JAVA' => {
    ...
    'BUILDTYPE' => [
      { 'name' => 'Ant', 'compiler' => [ 'None' ] },
    ],
    ...
  }

Configuring which rules of FindBugs should be checked

FindBugs has the possibility to detect many different bug patterns. All these patterns are listed within the FindBugs installation in the following file FindBugs/doc/allBugDescriptions.html. The user is free to choose any set of bug patterns that should be reported by TICS. As with other codecheckers, this is done by editing the RULES.txt and the IMPL.txt files within the cfg directory on the TICS FileServer. The user is free to choose the rule's identifier, severity level, category and synopsis in the RULES.txt. How TICS invokes FindBugs is configured in the IMPL.txt. In this file, the "long bug codes" of FindBugs should be used. These "long bug codes" are the strings between brackets after the bug pattern description in the allBugDescriptions.html page. A short example of the IMPL.txt file is given below:

FB#001	FindBugs	LI_LAZY_INIT_UPDATE_STATIC
FB#002	FindBugs	REC_CATCH_EXCEPTION
FB#003	FindBugs	DM_EXIT
FB#004	FindBugs	DP_CREATE_CLASSLOADER_INSIDE_DO_PRIVILEGED
FB#005	FindBugs	EQ_COMPARETO_USE_OBJECT_EQUALS

A standard FindBugs rule configuration is available in the form of a IMPL.txt, RULES.txt pair.

See the FindBugs website for a list of all FindBugs warnings.