Skip to content

Commit

Permalink
refactor: be consistent with report data / output terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
elsapet committed Aug 25, 2023
1 parent 10995f7 commit 9c2173d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions new/detector/composition/testhelper/testhelper.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (runner *Runner) scanSingleFile(t *testing.T, testDataPath string, fileRela
}

runner.config.Scan.Target = testDataPath
output, err := output.GetOutput(
reportData, err := output.GetData(
types.Report{
Path: detectorsReportPath,
},
Expand All @@ -154,7 +154,7 @@ func (runner *Runner) scanSingleFile(t *testing.T, testDataPath string, fileRela
t.Fatalf("failed to get output: %s", err)
}

report, err := util.ReportYAML(output.FindingsBySeverity)
report, err := util.ReportYAML(reportData.FindingsBySeverity)
if err != nil {
t.Fatalf("failed to encoded to yaml: %s", err)
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/commands/artifact/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ func (r *runner) Scan(ctx context.Context, opts flag.Options) ([]files.File, *ba

report := types.Report{Path: r.reportPath + ".base", Inputgocloc: r.goclocResult}

reportOutput, err := reportoutput.GetOutput(report, r.scanSettings, nil)
reportData, err := reportoutput.GetData(report, r.scanSettings, nil)
if err != nil {
return err
}

baseBranchFindings = buildBaseBranchFindings(reportOutput, fileList)
baseBranchFindings = buildBaseBranchFindings(reportData, fileList)

if !opts.Quiet {
outputhandler.StdErrLog("\nScanning current branch")
Expand Down Expand Up @@ -325,7 +325,7 @@ func (r *runner) Report(
outputhandler.StdErrLog("Using cached data")
}

output, err := reportoutput.GetOutput(report, r.scanSettings, baseBranchFindings)
reportData, err := reportoutput.GetData(report, r.scanSettings, baseBranchFindings)
if err != nil {
return false, err
}
Expand All @@ -339,7 +339,7 @@ func (r *runner) Report(

if !reportSupported && r.scanSettings.Report.Report != flag.ReportPrivacy {
var placeholderStr *strings.Builder
placeholderStr, err = getPlaceholderOutput(output, report, r.scanSettings, report.Inputgocloc)
placeholderStr, err = getPlaceholderOutput(reportData, report, r.scanSettings, report.Inputgocloc)
if err != nil {
return false, err
}
Expand All @@ -349,7 +349,7 @@ func (r *runner) Report(
}

formatStr, err := reportoutput.FormatOutput(
output,
reportData,
r.scanSettings,
report.Inputgocloc,
startTime,
Expand Down
2 changes: 1 addition & 1 deletion pkg/report/output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

var ErrUndefinedFormat = errors.New("undefined output format")

func GetOutput(
func GetData(
report globaltypes.Report,
config settings.Config,
baseBranchFindings *basebranchfindings.Findings,
Expand Down
2 changes: 1 addition & 1 deletion pkg/report/output/privacy/privacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestBuildCsvString(t *testing.T) {
cupaloy.SnapshotT(t, stringBuilder.String())
}

func TestGetOutput(t *testing.T) {
func TestGetData(t *testing.T) {
config, err := generateConfig(flag.ReportOptions{Report: "privacy"})
config.Rules = map[string]*settings.Rule{
"ruby_third_parties_sentry": config.Rules["ruby_third_parties_sentry"],
Expand Down

0 comments on commit 9c2173d

Please sign in to comment.