Skip to content

Commit

Permalink
Apply minor style changes to perfdash config validation
Browse files Browse the repository at this point in the history
As a followup from previous PR, this fixes minor style issues in the
config validation logic:
- use of named return values
- comment was not formatted properly
- typo in comment
  • Loading branch information
Jakub Pierewoj committed Oct 2, 2019
1 parent 1ba599b commit 62dee75
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions perfdash/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func getProwConfig(configPaths []string) (Jobs, error) {
periodic.Name, err)
continue
}
shouldUse, err := validatePeriodicConfig(config)
shouldUse, err := checkIfConfigShouldBeUsed(config)
if err != nil {
fmt.Fprintf(os.Stderr, "warning: failed to validate config of %q due to: %v\n",
periodic.Name, err)
Expand Down Expand Up @@ -431,13 +431,13 @@ func parsePeriodicConfig(periodic periodic) (Tests, error) {
return thisPeriodicConfig, nil
}

func validatePeriodicConfig(config Tests) (shouldUse bool, err error) {
func checkIfConfigShouldBeUsed(config Tests) (bool, error) {
if config.Prefix == "" && config.Descriptions == nil {
// this is expected case for jobs which are not expected to be visible in perfdash
// This is expected case for jobs which are not expected to be visible in perfdash.
return false, nil
}
if config.Prefix == "" || config.Descriptions == nil {
return false, fmt.Errorf("nonee or both of prefix and job type must be specified")
return false, fmt.Errorf("none or both of prefix and job type must be specified")
}
return true, nil
}

0 comments on commit 62dee75

Please sign in to comment.