Skip to content

Commit

Permalink
fix: remove deprecated Reporter methods (#722)
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath authored Jan 2, 2024
1 parent 70a5894 commit ff7f2d6
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 60 deletions.
8 changes: 0 additions & 8 deletions pkg/reporter/gh-annotations_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ func NewGHAnnotationsReporter(stdout io.Writer, stderr io.Writer) *GHAnnotations
}
}

func (r *GHAnnotationsReporter) PrintError(msg string) {
r.PrintErrorf(msg)
}

func (r *GHAnnotationsReporter) PrintErrorf(msg string, a ...any) {
fmt.Fprintf(r.stderr, msg, a...)
r.hasPrintedError = true
Expand All @@ -35,10 +31,6 @@ func (r *GHAnnotationsReporter) HasPrintedError() bool {
return r.hasPrintedError
}

func (r *GHAnnotationsReporter) PrintText(msg string) {
r.PrintTextf(msg)
}

func (r *GHAnnotationsReporter) PrintTextf(msg string, a ...any) {
fmt.Fprintf(r.stderr, msg, a...)
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/reporter/json_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ func NewJSONReporter(stdout io.Writer, stderr io.Writer) *JSONReporter {
}
}

func (r *JSONReporter) PrintError(msg string) {
r.PrintErrorf(msg)
}

func (r *JSONReporter) PrintErrorf(msg string, a ...any) {
fmt.Fprintf(r.stderr, msg, a...)
r.hasPrintedError = true
Expand All @@ -35,10 +31,6 @@ func (r *JSONReporter) HasPrintedError() bool {
return r.hasPrintedError
}

func (r *JSONReporter) PrintText(msg string) {
r.PrintTextf(msg)
}

func (r *JSONReporter) PrintTextf(msg string, a ...any) {
// Print non json text to stderr
fmt.Fprintf(r.stderr, msg, a...)
Expand Down
21 changes: 1 addition & 20 deletions pkg/reporter/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,18 @@ import (
)

type Reporter interface {
// PrintError prints errors in an appropriate manner to ensure that results
// are printed in a way that is semantically valid for the intended consumer,
// and tracking that an error has been printed.
//
// Where the error is actually printed (if at all) is entirely up to the actual
// reporter, though generally it will be to stderr.
//
// Deprecated: use PrintErrorf instead
PrintError(msg string)
// PrintErrorf prints errors in an appropriate manner to ensure that results
// are printed in a way that is semantically valid for the intended consumer,
// and tracking that an error has been printed.
//
// Where the error is actually printed (if at all) is entirely up to the actual
// reporter, though generally it will be to stderr.
PrintErrorf(msg string, a ...any)
// HasPrintedError returns true if there have been any calls to PrintError or
// PrintErrorf.
// HasPrintedError returns true if there have been any calls to PrintErrorf.
//
// This does not actually represent if the error was actually printed anywhere
// since what happens to the error message is up to the actual reporter.
HasPrintedError() bool
// PrintText prints text in an appropriate manner to ensure that results
// are printed in a way that is semantically valid for the intended consumer.
//
// Where the text is actually printed (if at all) is entirely up to the actual
// reporter; in most cases for "human format" reporters this will be stdout
// whereas for "machine format" reporters this will stderr.
//
// Deprecated: use PrintTextf instead
PrintText(msg string)
// PrintTextf prints text in an appropriate manner to ensure that results
// are printed in a way that is semantically valid for the intended consumer.
//
Expand Down
8 changes: 0 additions & 8 deletions pkg/reporter/sarif_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ func NewSarifReporter(stdout io.Writer, stderr io.Writer) *SARIFReporter {
}
}

func (r *SARIFReporter) PrintError(msg string) {
r.PrintErrorf(msg)
}

func (r *SARIFReporter) PrintErrorf(msg string, a ...any) {
fmt.Fprintf(r.stderr, msg, a...)
r.hasPrintedError = true
Expand All @@ -35,10 +31,6 @@ func (r *SARIFReporter) HasPrintedError() bool {
return r.hasPrintedError
}

func (r *SARIFReporter) PrintText(msg string) {
r.PrintTextf(msg)
}

func (r *SARIFReporter) PrintTextf(msg string, a ...any) {
fmt.Fprintf(r.stderr, msg, a...)
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/reporter/table_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ func NewTableReporter(stdout io.Writer, stderr io.Writer, markdown bool, termina
}
}

func (r *TableReporter) PrintError(msg string) {
r.PrintErrorf(msg)
}

func (r *TableReporter) PrintErrorf(msg string, a ...any) {
fmt.Fprintf(r.stderr, msg, a...)
r.hasPrintedError = true
Expand All @@ -40,10 +36,6 @@ func (r *TableReporter) HasPrintedError() bool {
return r.hasPrintedError
}

func (r *TableReporter) PrintText(msg string) {
r.PrintTextf(msg)
}

func (r *TableReporter) PrintTextf(msg string, a ...any) {
fmt.Fprintf(r.stdout, msg, a...)
}
Expand Down
8 changes: 0 additions & 8 deletions pkg/reporter/void_reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ type VoidReporter struct {
hasPrintedError bool
}

func (r *VoidReporter) PrintError(msg string) {
r.PrintErrorf(msg)
}

func (r *VoidReporter) PrintErrorf(msg string, a ...any) {
r.hasPrintedError = true
}
Expand All @@ -20,10 +16,6 @@ func (r *VoidReporter) HasPrintedError() bool {
return r.hasPrintedError
}

func (r *VoidReporter) PrintText(msg string) {
r.PrintTextf(msg)
}

func (r *VoidReporter) PrintTextf(msg string, a ...any) {
}

Expand Down

0 comments on commit ff7f2d6

Please sign in to comment.