I am using Gradle FindBugs Plugin. How can I print reported bugs to console? PMD plugin has a consoleOutput property. Is there a similar property for FindBugs?
As you can see here there's no such property or configuration possibility for FindBugs plugin. However it seems that the plugin can be customized in some way. E.g. by parsing and displaying the results.
See here and here.
This is rudimentary ... but it's a start
task checkFindBugsReport << {
def xmlReport = findbugsMain.reports.xml
if (!xmlReport.destination.exists()) return;
def slurped = new XmlSlurper().parse(xmlReport.destination)
def report = ""
slurped['BugInstance'].eachWithIndex { bug, index ->
report += "${index + 1}. Found bug risk ${bug.@'type'} of category ${bug.@'category'} "
report += "in the following places"
bug['SourceLine'].each { place ->
report += "\n ${place.@'classname'} at lines ${place.@'start'}:${place.@'end'}"
}
}
if (report.length() > 1) {
logger.error "[FINDBUGS]\n ${report}"
}
}
findbugsMain.finalizedBy checkFindBugsReport
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With