What is FaultBuster?

FaultBuster is An Automatic Code Smell Refactoring Toolset. It is able to support automatic refactoring: identifying the problematic code parts via static code analysis, running automatic algorithms to fix selected antipatterns, and executing integrated testing tools. In the heart of the toolset lies a refactoring framework to control the analysis and the execution of automatic algorithms. FaultBuster has IDE plugins as well, to interact with developers via popular IDEs (Eclipse, Netbeans and IntelliJ IDEA).


Refactoring toolkit demonstration.


Download demo

You can download a live demo of FaultBuster here.

(You may need to download VM Player to run the demo.)

How does it work?

The toolset consists of a core component called Refactoring Framework, three IDE plugins to communicate with the framework and a standalone Java Swing client.

1) The Refactoring Framework:

This component is the heart of FaultBuster as its main task is to control the whole refactoring process. The framework deals with the continuous quality measurements of the source code, identification of critical parts from the viewpoint of refactoring, the restructuring of them, the measurement of quality improvement and the support of regression tests to verify the invariance after applying the refactorings. In order to do so, the framework:

  • Controls the analysis process and stores the results in a central database: it regularly checks out the source code of the system from a version control system (Subversion, CVS, Mercurial, Git), executes static analyzers (Java analyzer, rule checker, antipattern detector, etc.)  and uploads the results to the database.
  • Provides an interface through web services to query the results of the analyses and to execute automatic refactoring algorithms for selected problems. After executing the algorithms, the framework generates a patch and sends it back to the client. The framework was designed to be independent from the programming language and refactoring, so it is suitable to support new programming languages and to easily extend it with additional refactorings.

2) IDE plugins:

We implemented plugins for today’s most popular development environments for Java (Eclipse, NetBeans, IntelliJ IDEA) and integrated them into the framework. The goal of these plugins is to bring the refactoring activities to be implemented closer to the  developers.

A plugin obtains a list of quality problems of the source code from the framework, processes the results, and shows to the developer the critical points which influence software quality negatively. A developer can select one or more problems from this list and ask for solution(s) from the framework, which can be then visualized and (after confirmation) applied to the code by the plugin. Finally, the developer can make some minor changes to it (e.g. commenting) and commit the final patch to the version control system.

3) Standalone Swing Client:

Besides the IDE plugins, we implemented a standalone client to communicate with the Refactoring Framework. First this client had testing purposes, but finally it implemented all the necessary features of the whole system, so it became a useful standalone tool in FaultBuster. The client is able to browse the reports on problematic code fragments in the system, select problems for refactoring, and invoke the refactoring  algorithms.

4) Administrator Pages:

The framework has two graphical user interfaces to configure its settings. Analysis tasks are controlled by Jenkins to periodically check out the source code and to execute the static analyzers. These tasks can be configured through the admin page of Jenkins. The rest of the framework can be configured through its own admin pages. Here, it is possible to configure user profiles and set some global parameters of the refactoring algorithms. In addition, this interface can be used to examine log messages and statistics of the framework.

5) Refactoring Algorithms:

We implemented automatic refactoring algorithms to fix common code smells and bad programming practices. The input of such an algorithm is a coding issue (with its kind and position information) and the abstract semantic graph (ASG) of the source code generated by the SourceMeter tool. The output of an algorithm is a patch (diff file) fixing the selected problem.

FaultBuster implements algorithms to solve 40 different kinds of coding issues in Java. Most of these algorithms solve common programming flaws like ‘empty catch block’, ‘avoid print stack trace’, ‘boolean instantiation’, while some of them implement heuristics to fix antipatterns such as long function, too complex methods or code duplications.

An algorithm can be a full automatic algorithm or a semiautomatic algorithm (which interacts with the developer). For instance, in the case of a ‘method naming convention’ issue it is possible to ask the developer to give a new name for the badly named method, but in the case of a ‘local variable could be final’ issue, the final keyword can be simply inserted to the declaration of the variable automatically.

It is also possible to select more occurrences of the same problem and fix them all together by invoking a so-called batch refactoring task. In this case, the Refactoring Framework will execute the refactoring algorithms and will generate a patch containing the fixes for all the selected problems.

List of supported refactorings

The following coding issue types can be fixed with FaultBuster:

  • AddEmptyString
  • ArrayIsStoredDirectly
  • AvoidInstanceofChecksInCatchClause
  • AvoidPrintStackTrace
  • AvoidReassigningParameters
  • AvoidThrowingNullPointerException
  • AvoidThrowingRawExceptionTypes
  • BooleanGetMethodName
  • BooleanInstantiation
  • Clone Class (experimental)
  • CyclomaticComplexity
  • EmptyCatchBlock
  • EmptyIfStmt
  • ExcessiveMethodLength
  • LocalVariableCouldBeFinal
  • LongFunction
  • LooseCoupling
  • MethodNamingConventions
  • MethodWithSameNameAsEnclosingClass
  • NPathComplexity
  • PositionLiteralsFirstInComparisons
  • PreserveStackTrace
  • ReplaceHashtableWithMap
  • ReplaceVectorWithList
  • ShortMethodName
  • SimpleDateFormatNeedsLocale
  • SuspiciousHashcodeMethodName
  • SwitchStmtsShouldHaveDefault
  • TooManyMethods
  • UnnecessaryConstructor
  • UnnecessaryLocalBeforeReturn
  • UnusedImports
  • UnusedLocalVariable
  • UnusedPrivateField
  • UnusedPrivateMethod
  • UseArrayListInsteadOfVector
  • UseEqualsToCompareStrings
  • UseLocaleWithCaseConversions
  • UseStringBufferForStringAppends
  • UselessParentheses


Project information

The implementation of FaultBuster was supported by the EU supported Hungarian national grant GOP-1.2.1-11-2011-0002.