Search code examples
jenkinsjenkins-pluginsfindbugspmdjenkins-api

Is there any Jenkins API to retrieve PMD/ findbugs, checkstyle results


I have a requirement to retrieve Findbugs, PMD and checkstyle reports using API.

FindBugs: bug report can be extracted from findbug.xml
Is there any other option other than extracting report from xml files?

Update: Answer

As @Andrew said, You can find findbugs result json by appending /api/json to jenkins results:

http://<jenkins-host:port>/job/<your_job_name>/<build_id>/7/findbugsResult/api/json?depth=2

http://<jenkins-host:port>/job/<your_job_name>/<build_id>/7/pmdResult/api/json?depth=2

http://<jenkins-host:port>/job/<your_job_name>/<build_id>/7/checkstyleResult/api/json?depth=2

If you want only numbers use /api/json?depth=0


Solution

  • Jenkins REST API exposes the information on many of the key pages as json by adding the suffix /api/json.

    The relevant plugins that publish these type of results to the dashboard are the Warnings and Static Code Analysis plugins, both written by Ulli Hafner

    The Warnings Plugin (since release 4.49) seem to support retrieving result information via the Jenkins Restful interface. Have a read of the conversation here.