From 6632e1db3d21f1a7a75c06ff1bb721ec8b764989 Mon Sep 17 00:00:00 2001 From: elsapet Date: Wed, 27 Sep 2023 15:17:39 +0200 Subject: [PATCH] fix: avoid compiling privacy report twice (#1290) * fix: avoid compiling privacy report twice * feat: remove AddReportData call from CSV method --- internal/report/output/privacy/privacy.go | 4 ---- internal/report/output/privacy/privacy_test.go | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/report/output/privacy/privacy.go b/internal/report/output/privacy/privacy.go index 703cd7efd..e07b4784d 100644 --- a/internal/report/output/privacy/privacy.go +++ b/internal/report/output/privacy/privacy.go @@ -68,10 +68,6 @@ const PLACEHOLDER_VALUE = "Unknown" func BuildCsvString(reportData *outputtypes.ReportData, config settings.Config) (*strings.Builder, error) { csvStr := &strings.Builder{} csvStr.WriteString("\nSubject,Data Types,Detection Count,Critical Risk Finding,High Risk Finding,Medium Risk Finding,Low Risk Finding,Rules Passed\n") - err := AddReportData(reportData, config) - if err != nil { - return csvStr, err - } for _, subject := range reportData.PrivacyReport.Subjects { subjectArr := []string{ diff --git a/internal/report/output/privacy/privacy_test.go b/internal/report/output/privacy/privacy_test.go index 20ed63bee..cd370815e 100644 --- a/internal/report/output/privacy/privacy_test.go +++ b/internal/report/output/privacy/privacy_test.go @@ -28,6 +28,10 @@ func TestBuildCsvString(t *testing.T) { output := &outputtypes.ReportData{ Dataflow: dummyDataflow(), } + err = privacy.AddReportData(output, config) + if err != nil { + t.Fatalf("failed to add privacy report:%s", err) + } stringBuilder, _ := privacy.BuildCsvString(output, config) cupaloy.SnapshotT(t, stringBuilder.String()) }