Skip to content

Commit

Permalink
refactor: rename isProcessListSorted to validateProcessesOrder for cl…
Browse files Browse the repository at this point in the history
…arity
  • Loading branch information
prbn021 committed Jan 13, 2025
1 parent 70a012e commit 8a78559
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/provider/resource_tsuru_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func resourceTsuruApplicationCreate(ctx context.Context, d *schema.ResourceData,
if m, ok := d.GetOk("process"); ok {
processes := processesFromResourceData(m)
if processes != nil {
err := isProcessListSorted(processes)
err := validateProcessesOrder(processes)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -310,7 +310,7 @@ func resourceTsuruApplicationUpdate(ctx context.Context, d *schema.ResourceData,
if newProcesses == nil {
newProcesses = []tsuru_client.AppProcess{}
}
err := isProcessListSorted(newProcesses)
err := validateProcessesOrder(newProcesses)
if err != nil {
return diag.FromErr(err)
}
Expand Down Expand Up @@ -342,7 +342,7 @@ func resourceTsuruApplicationUpdate(ctx context.Context, d *schema.ResourceData,
return resourceTsuruApplicationRead(ctx, d, meta)
}

func isProcessListSorted(processes []tsuru_client.AppProcess) error {
func validateProcessesOrder(processes []tsuru_client.AppProcess) error {
for i := 1; i < len(processes); i++ {
if processes[i-1].Name > processes[i].Name {
return errors.Errorf("please, sort app processes alphabetically")
Expand Down

0 comments on commit 8a78559

Please sign in to comment.