javapluginsfindbugs

FindBugs in Intellij - Possible to reuse .fbpref file?


Originally Eclipse was dominating, so settings made in the Eclipse IDE are now being transferred to IntelliJ.

I am in the process of installing a Findbugs plugin for IntelliJ. I came across FindBugs-IDEA and QAPlug-Findbugs.

I checked both and they require a .xml file as possible "ruleset". I only have the .fbpref file from eclipse though, which looks like that:

...
detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|true
detectorAtomicityProblem=AtomicityProblem|true
detectorBadAppletConstructor=BadAppletConstructor|false
detectorBadResultSetAccess=BadResultSetAccess|true
detectorBadSyntaxForRegularExpression=BadSyntaxForRegularExpression|true
...

Is it possible to convert this to a .xml-file that is accepted by one of the plugins i mentioned? Is there any documentation on how a .xml file for these plugins should look like? I have tried googling it but I had no luck.

It seems that using a configuration file to configure the behavior of the FindBugs-plugin is somewhat unusual practice?


Solution

  • If you have installed the FindBugs plugin, an XML file already exists:

    project/.idea/findbugs-idea.xml
    

    There is however no converter for .fbprefs. You can open both settings windows:

    and copy those settings manually. You can also open both files (xml and .fbprefs) and move some settings a little faster by copy&paste (especially the detectors).

    There is a great service called Transformy, which can transform those detectors easily. Insert your detector lines in the left panel:

    detectorAppendingToAnObjectOutputStream=AppendingToAnObjectOutputStream|false
    detectorAtomicityProblem=AtomicityProblem|true
    detectorBCPMethodReturnCheck=BCPMethodReturnCheck|false
    ....
    

    and use this as a format to transform:

    <entry key="AppendingToAnObjectOutputStream" value="false" />
    

    Unfortunately, it messes up rules which contain numbers, like FindSelfComparison2, so copy those manually.