FindBugs generates reports in different formats

I am using FindBugs to generate some reports for a java project. I used the following command:

./findbugs-3.0.1/bin/findbugs -textui -high -nested:false -sortByClass -html -output h.html  -auxclasspath ../LabMetrics/operations/utilJars/junit.jar -auxclasspath ../LabMetrics/operations/utilJars/hamcrest-core-1.3.jar  ../LabMetrics/operations/target/classes

      

It works fine and html report is generated. Also, when I use this command: the ./findbugs-3.0.1/bin/findbugs -textui -high -nested:false -sortByClass -output h.txt -auxclasspath ../LabMetrics/operations/utilJars/junit.jar -auxclasspath ../LabMetrics/operations/utilJars/hamcrest-core-1.3.jar ../LabMetrics/operations/target/classes

output will be redirected to the h.txt file.

Now I want to generate an html and txt report containing only the command. This action is time-consuming, and I don't want to parse the same code twice, only to get the same report, but with a different format. I searched the FindBugs site but no result. I really don't want to parse the html report source to generate a txt report. There must be a way to get two reports in one pass.

+3


source to share


1 answer


Better to create XML first. XML contains all the information you need and can be translated to whatever you need using some non-trivial command lines.

For example, if you have analysisResult.xml to generate txt report then use

java -cp findbugs.jar edu.umd.cs.findbugs.PrintingBugReporter -txt analysisResult.xml >output.txt

      



To generate HTML report use

java -cp findbugs.jar edu.umd.cs.findbugs.PrintingBugReporter -html analysisResult.xml >output.html

      

+3


source







All Articles