Scorecard is a backstage plugin and supports multiple metric, grouped as modules in folder workspaces/scorecard/plugins.
There are already modules that support GitHub, OpenSSF, SonarQube. Add a new module for code-coverage.
That is different then the codecov module mentioned in #3473. Because codecov is dedicated for the codecov provider, while this "code-coverage" module is for the Backstage Community Plugin "code-coverage" from https://github.com/backstage/community-plugins/tree/main/workspaces/code-coverage.
With this, this new code-coverage module would support tools like cobertura, jacoco, and lcov.
This module will repopulate this code coverage values from that plugin into the scorecard plugin. For this, this new metrics should load the data from the code-coverage-backend and provide them as MetricProvider(s) in the newly created scorecard-backend-module-code-coverage module.
The https://github.com/backstage/community-plugins/blob/main/workspaces/code-coverage/plugins/code-coverage-backend/README.md explain which data are available throw the history API call:
GET /api/code-coverage/report?entity=component:default/entity-name
{
"aggregate": {
"branch": {
"available": 0,
"covered": 0,
"missed": 0,
"percentage": 0
},
"line": {
"available": 5,
"covered": 4,
"missed": 1,
"percentage": 80
}
},
"entity": {
"kind": "Component",
"name": "entity-name",
"namespace": "default"
},
"files": [
{
"branchHits": {},
"filename": "main.go",
"lineHits": {
"117": 12,
"142": 8,
"34": 8,
"42": 0,
"58": 6
}
}
]
}
Based on that data the following metrics should be possible:
- Code coverage (Lines) (Percentage value based on
aggregate.line.percentage)
- Code coverage - Tracked lines of code (based on
aggregate.line.available)
- Code coverage - Covered lines of code (based on
aggregate.line.covered)
- Code coverage - Missed lines of code (based on
aggregate.line.missed)
- Code coverage (Files) (Percentage value based on
aggregate.branch.percentage)
- Code coverage - Tracked lines of code (based on
aggregate.branch.available)
- Code coverage - Covered lines of code (based on
aggregate.branch.covered)
- Code coverage - Missed lines of code (based on
aggregate.branch.missed)
All metrics providers should filter for entities with annotation backstage.io/code-coverage.
Add a type definition for the code-coverage Backend response
Add tests and integrate the new code-coverage module as well as the Code Coverage frontend and backend from the Backstage Community plugin into the existing Backstage app.
Add an example entity for code-coverage with the right annotation for it.
Scorecard is a backstage plugin and supports multiple metric, grouped as modules in folder
workspaces/scorecard/plugins.There are already modules that support GitHub, OpenSSF, SonarQube. Add a new module for
code-coverage.That is different then the
codecovmodule mentioned in #3473. Because codecov is dedicated for the codecov provider, while this "code-coverage" module is for the Backstage Community Plugin "code-coverage" from https://github.com/backstage/community-plugins/tree/main/workspaces/code-coverage.With this, this new code-coverage module would support tools like cobertura, jacoco, and lcov.
This module will repopulate this code coverage values from that plugin into the scorecard plugin. For this, this new metrics should load the data from the code-coverage-backend and provide them as MetricProvider(s) in the newly created
scorecard-backend-module-code-coveragemodule.The https://github.com/backstage/community-plugins/blob/main/workspaces/code-coverage/plugins/code-coverage-backend/README.md explain which data are available throw the history API call:
{ "aggregate": { "branch": { "available": 0, "covered": 0, "missed": 0, "percentage": 0 }, "line": { "available": 5, "covered": 4, "missed": 1, "percentage": 80 } }, "entity": { "kind": "Component", "name": "entity-name", "namespace": "default" }, "files": [ { "branchHits": {}, "filename": "main.go", "lineHits": { "117": 12, "142": 8, "34": 8, "42": 0, "58": 6 } } ] }Based on that data the following metrics should be possible:
aggregate.line.percentage)aggregate.line.available)aggregate.line.covered)aggregate.line.missed)aggregate.branch.percentage)aggregate.branch.available)aggregate.branch.covered)aggregate.branch.missed)All metrics providers should filter for entities with annotation
backstage.io/code-coverage.Add a type definition for the code-coverage Backend response
Add tests and integrate the new code-coverage module as well as the Code Coverage frontend and backend from the Backstage Community plugin into the existing Backstage app.
Add an example entity for code-coverage with the right annotation for it.