From 8f3af71c84c0987ea899c7445bc768acbb680ba7 Mon Sep 17 00:00:00 2001 From: Vlad Klokun Date: Thu, 22 Dec 2022 10:49:24 +0200 Subject: [PATCH] style: shorten receiver names in HTML Printer --- core/pkg/resultshandling/printer/v2/htmlprinter.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/pkg/resultshandling/printer/v2/htmlprinter.go b/core/pkg/resultshandling/printer/v2/htmlprinter.go index 5270896c..e90131cf 100644 --- a/core/pkg/resultshandling/printer/v2/htmlprinter.go +++ b/core/pkg/resultshandling/printer/v2/htmlprinter.go @@ -38,17 +38,17 @@ func NewHtmlPrinter() *HtmlPrinter { return &HtmlPrinter{} } -func (htmlPrinter *HtmlPrinter) SetWriter(outputFile string) { +func (hp *HtmlPrinter) SetWriter(outputFile string) { if strings.TrimSpace(outputFile) == "" { outputFile = htmlOutputFile } if filepath.Ext(strings.TrimSpace(outputFile)) != htmlOutputExt { outputFile = outputFile + htmlOutputExt } - htmlPrinter.writer = printer.GetWriter(outputFile) + hp.writer = printer.GetWriter(outputFile) } -func (htmlPrinter *HtmlPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) { +func (hp *HtmlPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj) { tplFuncMap := template.FuncMap{ "sum": func(nums ...int) int { total := 0 @@ -104,16 +104,16 @@ func (htmlPrinter *HtmlPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj resourceTableView := buildResourceTableView(opaSessionObj) reportingCtx := HTMLReportingCtx{opaSessionObj, resourceTableView} - err := tpl.Execute(htmlPrinter.writer, reportingCtx) + err := tpl.Execute(hp.writer, reportingCtx) if err != nil { logger.L().Error("failed to render template", helpers.Error(err)) } else { - printer.LogOutputFile(htmlPrinter.writer.Name()) + printer.LogOutputFile(hp.writer.Name()) } } -func (htmlPrinter *HtmlPrinter) Score(score float32) { +func (hp *HtmlPrinter) Score(score float32) { return }