mirror of
https://github.com/safedep/vet.git
synced 2025-12-10 00:22:08 -06:00
Improve markdown report
This commit is contained in:
parent
1e6c674d67
commit
be9f5f37ca
2
.github/workflows/container.yml
vendored
2
.github/workflows/container.yml
vendored
@ -4,6 +4,8 @@ on:
|
||||
push:
|
||||
tags:
|
||||
- "*"
|
||||
branches:
|
||||
- "main"
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
@ -27,8 +27,15 @@ type markdownTemplateInputRemediation struct {
|
||||
Score int
|
||||
}
|
||||
|
||||
type markdownTemplateInputResultSummary struct {
|
||||
Ecosystem string
|
||||
PackageCount int
|
||||
PackageWithIssuesCount int
|
||||
}
|
||||
|
||||
type markdownTemplateInput struct {
|
||||
Remediations []markdownTemplateInputRemediation
|
||||
Remediations map[string][]markdownTemplateInputRemediation
|
||||
Summary map[string]markdownTemplateInputResultSummary
|
||||
ManifestsCount int
|
||||
PackagesCount int
|
||||
}
|
||||
@ -73,14 +80,27 @@ func (r *markdownReportGenerator) Finish() error {
|
||||
}
|
||||
|
||||
sortedList := sr.sortedRemediations()
|
||||
remediations := []markdownTemplateInputRemediation{}
|
||||
remediations := map[string][]markdownTemplateInputRemediation{}
|
||||
summaries := map[string]markdownTemplateInputResultSummary{}
|
||||
|
||||
for _, s := range sortedList {
|
||||
remediations = append(remediations, markdownTemplateInputRemediation{
|
||||
mp := s.pkg.Manifest.Path
|
||||
remediations[mp] = append(remediations[mp], markdownTemplateInputRemediation{
|
||||
Pkg: s.pkg,
|
||||
PkgRemediationName: sr.packageNameForRemediationAdvice(s.pkg),
|
||||
Score: s.score,
|
||||
})
|
||||
|
||||
if _, ok := summaries[mp]; !ok {
|
||||
summaries[mp] = markdownTemplateInputResultSummary{
|
||||
Ecosystem: s.pkg.Manifest.Ecosystem,
|
||||
PackageCount: len(s.pkg.Manifest.Packages),
|
||||
}
|
||||
} else {
|
||||
s := summaries[mp]
|
||||
s.PackageWithIssuesCount += 1
|
||||
summaries[mp] = s
|
||||
}
|
||||
}
|
||||
|
||||
tmpl, err := template.New("markdown").Parse(markdownTemplate)
|
||||
@ -98,5 +118,6 @@ func (r *markdownReportGenerator) Finish() error {
|
||||
Remediations: remediations,
|
||||
ManifestsCount: sr.summary.manifests,
|
||||
PackagesCount: sr.summary.packages,
|
||||
Summary: summaries,
|
||||
})
|
||||
}
|
||||
|
||||
@ -2,18 +2,33 @@
|
||||
|
||||
## Summary
|
||||
|
||||
* {{ .ManifestsCount }} manifest(s) were scanned
|
||||
* {{ .PackagesCount }} packages were analyzed
|
||||
| | |
|
||||
|-----------|-----------------------|
|
||||
| Manifests | {{ .ManifestsCount }} |
|
||||
| Packages | {{ .PackagesCount }} |
|
||||
|
||||
## Results
|
||||
|
||||
| Manifest | Ecosystem | Packages | :x: Packages with Issues |
|
||||
|----------|-----------|----------|--------------------------|
|
||||
{{- range $key, $value := .Summary }}
|
||||
| {{ $key }} | {{ $value.Ecosystem }} | {{ $value.PackageCount }} | {{ $value.PackageWithIssuesCount }} |
|
||||
{{- end }}
|
||||
|
||||
## Remediation Advice
|
||||
|
||||
The table below lists advice for dependency upgrade to mitigate one or more
|
||||
issues identified during the scan.
|
||||
|
||||
{{ range $key, $value := .Remediations }}
|
||||
> {{ $key }}
|
||||
|
||||
| Package | Update Version | Risk Score | Issues |
|
||||
|---------|----------------|------------|--------|
|
||||
{{- range .Remediations }}
|
||||
{{- range $value }}
|
||||
| {{ .PkgRemediationName }} | {{ .Pkg.Insights.PackageCurrentVersion }} | {{ .Score }} | - |
|
||||
{{- end }}
|
||||
{{ end }}
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user