Skip to content

Commit

Permalink
refactor: shorthand for case statement
Browse files Browse the repository at this point in the history
  • Loading branch information
elsapet committed Aug 25, 2023
1 parent ba8f94a commit 9941cda
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
4 changes: 1 addition & 3 deletions pkg/report/output/dataflow/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func NewFormatter(reportData *outputtypes.ReportData, config settings.Config) *F

func (f Formatter) Format(format string) (output *string, err error) {
switch format {
case flag.FormatEmpty:
output, err = outputhandler.ReportJSON(f.ReportData.Dataflow)
case flag.FormatJSON:
case flag.FormatEmpty, flag.FormatJSON:
output, err = outputhandler.ReportJSON(f.ReportData.Dataflow)
case flag.FormatYAML:
output, err = outputhandler.ReportYAML(f.ReportData.Dataflow)
Expand Down
4 changes: 1 addition & 3 deletions pkg/report/output/detectors/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func NewFormatter(reportData *outputtypes.ReportData, config settings.Config) *F

func (f Formatter) Format(format string) (output *string, err error) {
switch format {
case flag.FormatEmpty:
output, err = outputhandler.ReportJSON(f.ReportData.Detectors)
case flag.FormatJSON:
case flag.FormatEmpty, flag.FormatJSON:
output, err = outputhandler.ReportJSON(f.ReportData.Detectors)
case flag.FormatYAML:
output, err = outputhandler.ReportYAML(f.ReportData.Detectors)
Expand Down
4 changes: 1 addition & 3 deletions pkg/report/output/saas/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func NewFormatter(reportData *outputtypes.ReportData, config settings.Config) *F

func (f Formatter) Format(format string) (output *string, err error) {
switch format {
case flag.FormatEmpty:
output, err = outputhandler.ReportJSON(f.ReportData.SaasReport)
case flag.FormatJSON:
case flag.FormatEmpty, flag.FormatJSON:
output, err = outputhandler.ReportJSON(f.ReportData.SaasReport)
case flag.FormatYAML:
output, err = outputhandler.ReportYAML(f.ReportData.SaasReport)
Expand Down
4 changes: 1 addition & 3 deletions pkg/report/output/stats/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ func NewFormatter(reportData *outputtypes.ReportData, config settings.Config) *F

func (f Formatter) Format(format string) (output *string, err error) {
switch format {
case flag.FormatEmpty:
output, err = outputhandler.ReportJSON(f.ReportData.Stats)
case flag.FormatJSON:
case flag.FormatEmpty, flag.FormatJSON:
output, err = outputhandler.ReportJSON(f.ReportData.Stats)
case flag.FormatYAML:
output, err = outputhandler.ReportYAML(f.ReportData.Stats)
Expand Down

0 comments on commit 9941cda

Please sign in to comment.