Skip to content

Commit

Permalink
fix: avoid compiling privacy report twice (#1290)
Browse files Browse the repository at this point in the history
* fix: avoid compiling privacy report twice

* feat: remove AddReportData call from CSV method
  • Loading branch information
elsapet authored Sep 27, 2023
1 parent 92b2534 commit 6632e1d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 0 additions & 4 deletions internal/report/output/privacy/privacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
4 changes: 4 additions & 0 deletions internal/report/output/privacy/privacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand Down

0 comments on commit 6632e1d

Please sign in to comment.