Skip to content

Commit

Permalink
use switch statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Ontiveros committed Jul 5, 2023
1 parent cdb3d4f commit 386ce5b
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions pkg/api/admin/openshiftcluster_validatestatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,35 @@ func (sv openShiftClusterStaticValidator) validateDelta(oc, current *OpenShiftCl
}

func invalidMaintenanceTask(task MaintenanceTask) bool {
if task == "" ||
task == MaintenanceTaskEverything ||
task == MaintenanceTaskOperator ||
task == MaintenanceTaskRenewCerts ||
task == MaintenanceTaskStateUpdate {
switch task {
case "":
fallthrough
case MaintenanceTaskEverything:
fallthrough
case MaintenanceTaskOperator:
fallthrough
case MaintenanceTaskRenewCerts:
fallthrough
case MaintenanceTaskStateUpdate:
return false
}

return true
}

func invalidMaintenanceState(state MaintenanceState) bool {
if state == "" ||
state == MaintenanceStateNone ||
state == MaintenanceStatePending ||
state == MaintenanceStatePlanned ||
state == MaintenanceStateUnplanned {
switch state {
case "":
fallthrough
case MaintenanceStateNone:
fallthrough
case MaintenanceStatePending:
fallthrough
case MaintenanceStatePlanned:
fallthrough
case MaintenanceStateUnplanned:
return false

Check failure on line 72 in pkg/api/admin/openshiftcluster_validatestatic.go

View workflow job for this annotation

GitHub Actions / golangci-lint

unnecessary trailing newline (whitespace)
}

return true
Expand Down

0 comments on commit 386ce5b

Please sign in to comment.