jenkinsci / code-coverage-api-plugin

Deprecated Jenkins Code Coverage Plugin
https://plugins.jenkins.io/code-coverage-api/
MIT License
111 stars 77 forks source link

Remote API to connect additional code review tools #731

Closed fo-code closed 10 months ago

fo-code commented 1 year ago

What feature do you want to see added?

I would like to show the calculated coverage results in additional code review tools except GitHub so the user can review the code and instantly see if the modified lines are covered even without navigating to Jenkins. This would be a big enhancement since it further decreases the effort to see required coverage information hence makes it more attractive for developers. Also, additional tools can be combined with this plugin.

More precisely, we want to implement a REST API that provides the coverage information of modified lines for each modified file.

My colleague and I would also implement this, but we are not sure how to do it in the best way. There is the CoverageViewModel that has a getApi() method that already offers more general information. How can we extend the plugin with an additional API as described above and which steps would be required in general?

@uhafner what do you think about this idea and could you please help us with our questions?

Upstream changes

No response

uhafner commented 1 year ago

There is some documentation in our developer guide.

In the warnings plugin I am using several API access points: https://github.com/jenkinsci/warnings-ng-plugin/tree/master/plugin/src/main/java/io/jenkins/plugins/analysis/core/restapi

You can even write a help file that shows the available end points:

https://github.com/jenkinsci/warnings-ng-plugin/blob/master/plugin/src/main/resources/io/jenkins/plugins/analysis/core/restapi/AnalysisResultApi/_api.jelly

So you can start the API end point in either a new URL or a sub page of coverage.

fo-code commented 1 year ago

Thanks a lot for helping! We will create a draft PR with the initial code and than enhance it step by step here.