jenkinsci / code-coverage-api-plugin

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

Provide a more generic way to define source code path #667

Closed urmol closed 1 year ago

urmol commented 1 year ago

What feature do you want to see added?

First off visually your plugin looks very nice and I'd love to be able to use it. I like the way the information is presented and provided in general. But there's a slight issue with source code location in the case where I have a single pipeline build script defined that is used for multiple projects. Since the location of the source code could vary from project to project a little, there could be differences in the directory names or just in general the project structure is a bit different (like a multi-module gradle project). So this makes defining the paths quite troublesome if not impossible in my scenario. For example with the Jacoco plugin you can do something like this in the pipeline: sourcePattern: '**/src/main/java' which is then able to find all source files in the workspace. Perhaps you could implement something very similar?

uhafner commented 1 year ago

Yes, for relative paths (paths that are within the workspace) this makes sense.

If you are interested in providing a PR, resolving the source code is handled in that class: plugin/src/main/java/io/jenkins/plugins/coverage/metrics/steps/PathResolver.java

Are you using JaCoCo? I think we should add a feature request there as well: it would be very helpful if that path can be stored by the coverage tool as well (Cobertura does this).