-
Notifications
You must be signed in to change notification settings - Fork 73
Closed
Labels
has-prThis issue has an associated PRThis issue has an associated PRvalidator-coreIssues that relate to the core validator functionalityIssues that relate to the core validator functionality
Description
In pkg/cli/cli.go there is a section where none of the reporter.Print*
method that could return errors are checked
config-file-validator/pkg/cli/cli.go
Lines 116 to 141 in 54b6781
if _, ok := c.Reporter.(reporter.JsonReporter); ok { | |
reporter.PrintSingleGroupJson(reportGroup) | |
} else if !Quiet { | |
reporter.PrintSingleGroupStdout(reportGroup) | |
} | |
} else if len(GroupOutput) == 2 { | |
reportGroup, err := GroupByDouble(reports, GroupOutput) | |
if err != nil { | |
return 1, fmt.Errorf("unable to group by double value: %v", err) | |
} | |
if _, ok := c.Reporter.(reporter.JsonReporter); ok { | |
reporter.PrintDoubleGroupJson(reportGroup) | |
} else if !Quiet { | |
reporter.PrintDoubleGroupStdout(reportGroup) | |
} | |
} else if len(GroupOutput) == 3 { | |
reportGroup, err := GroupByTriple(reports, GroupOutput) | |
if err != nil { | |
return 1, fmt.Errorf("unable to group by triple value: %v", err) | |
} | |
if _, ok := c.Reporter.(reporter.JsonReporter); ok { | |
reporter.PrintTripleGroupJson(reportGroup) | |
} else if !Quiet { | |
reporter.PrintTripleGroupStdout(reportGroup) | |
} |
This code requires a bit of refactoring, I think.
The addition of quiet mode (great addition BTW) with #124 made it even more complex to read and maintain.
Metadata
Metadata
Assignees
Labels
has-prThis issue has an associated PRThis issue has an associated PRvalidator-coreIssues that relate to the core validator functionalityIssues that relate to the core validator functionality