HandOfGod94 / jacoco-cov-badge-maven-plugin

Generate High Quality SVG, PNG and JPG Coverage badges locally from jacoco report as part of build
The Unlicense
7 stars 10 forks source link

Task: Custom Badge Key should be honored from configuration #7

Closed HandOfGod94 closed 6 years ago

HandOfGod94 commented 6 years ago

Default key for coverage badge is coverage. A user can also provide its custom value in maven configuration as badgeLabel. The value should be picked up for badge generation.

Expected: <badgeLabel>foo</badgeLabel> should generate label with foo as its value. Actual: Currently, its only generating label with coverage as the key

ccamel commented 6 years ago

@HandOfGod94 I can't reproduce the bug with the current version (0771c12c15ee09653c521451412328a8f003ca9d with Apache Maven 3.5.4).

From what I see from the code, it's correctly implemented.

By testing, it seems to work too.

Am I missing something here?

HandOfGod94 commented 6 years ago

Hi @ccamel, Thanks for the detailed comment I was not getting time to verify it with different configurations (like you did), that's the reason I kept it as an issue. In my initial implementation, I had hard coded it and I don't want to miss out on my TODOs.

Sorry the name is confusing, it's more of a verification then bug.

It still requires a little bit of testing to cover the corner-cases such as invalid or html-like string as coverage key. I'm expecting it might break with those kind of characters as I'm not escaping the values, might not be that important as it's just local generation of badges but still would like to cover those areas.

If you get the chance to verify do update the issue, with the values which you have tried so I can close it.

I'll try to finish few more issues/features over this weekend

Meanwhile, if you find it useful, feel free to use it.

ccamel commented 6 years ago

@HandOfGod94 Yes you're right. As the values are not escaped, the generated svg can be not well-formed.

For instance:

mvn -Dbadge.badgeLabel='<foo>' org.gahan:jacoco-badge-maven-plugin:1.0-SNAPSHOT:badge