1
0
Fork 0
mirror of https://github.com/gocsaf/csaf.git synced 2025-12-22 11:55:40 +01:00

Add datetime and version info to report of checker

Resolve #142 

Co-authored-by: Bernhard Reiter <bernhard@intevation.de>
This commit is contained in:
Fadi Abbud 2022-05-24 16:59:27 +02:00 committed by GitHub
parent 17f22855ee
commit 13423c3d4d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 5 deletions

View file

@ -189,6 +189,9 @@ func (p *processor) run(reporters []reporter, domains []string) (*Report, error)
for _, r := range reporters { for _, r := range reporters {
r.report(p, domain) r.report(p, domain)
} }
report.Version = util.SemVersion
now := time.Now()
report.Date = now.Format("2006-01-02T15:04:05Z")
report.Domains = append(report.Domains, domain) report.Domains = append(report.Domains, domain)
p.clean() p.clean()
} }

View file

@ -24,6 +24,8 @@ type Domain struct {
// Report is the overall report. // Report is the overall report.
type Report struct { type Report struct {
Domains []*Domain `json:"domains,omitempty"` Domains []*Domain `json:"domains,omitempty"`
Version string `json:"version,omitempty"`
Date string `json:"date,omitempty"`
} }
func (r *Requirement) message(msg ...string) { func (r *Requirement) message(msg ...string) {

View file

@ -6,17 +6,23 @@
<title>CSAF-Checker - Report</title> <title>CSAF-Checker - Report</title>
</head> </head>
<body> <body>
<h1>CSAF-Checker - Report</h1> <h1>CSAF-Checker - Report</h1>
{{- range .Domains }} {{- range .Domains }}
<h2>{{ .Name }}</h2> <h2>{{ .Name }}</h2>
<dl>
<dl>
{{ range .Requirements }} {{ range .Requirements }}
<dt><strong>Requirement {{ .Num }}: {{ .Description }}</strong></dt> <dt><strong>Requirement {{ .Num }}: {{ .Description }}</strong></dt>
{{ range .Messages }} {{ range .Messages }}
<dd>- {{ . }}</dd> <dd>- {{ . }}</dd>
{{ end }} {{ end }}
{{ end }} {{ end }}
</dl> </dl>
{{ end }} {{ end }}
<footer>
Date of run: <time datetime="{{.Date}}">{{.Date}}</time>
csaf_checker <span class=version>{{.Version}}</span>
</footer>
</body> </body>
</html> </html>