Skip to content

Commit 0969cd4

Browse files
committed
fix(lint): correct spelling of "unrecognised" to "unrecognized" in GCP CUD client
US-spelling fix across production error messages and comments in computeengine client; update matching test assertion to "unrecognized". Removes misspell nolint that was suppressing the lint warning.
1 parent da5b793 commit 0969cd4

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎providers/gcp/services/computeengine/client.go‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const maxMachineTypeItems = 20
4343
// - 1-year: "1yr", "1", "12mo"
4444
// - 3-year: "3yr", "3", "36mo"
4545
//
46-
// An empty or unrecognised term returns an error rather than silently defaulting
46+
// An empty or unrecognized term returns an error rather than silently defaulting
4747
// to 12 months; a silent mis-default can purchase the wrong term and waste money.
4848
func termPlan(term string) (string, error) {
4949
switch strings.ToLower(strings.TrimSpace(term)) {
@@ -52,7 +52,7 @@ func termPlan(term string) (string, error) {
5252
case "1yr", "1", "12mo":
5353
return computepb.Commitment_TWELVE_MONTH.String(), nil
5454
default:
55-
return "", fmt.Errorf("termPlan: unrecognised commitment term %q (accepted: 1yr/1/12mo or 3yr/3/36mo)", term)
55+
return "", fmt.Errorf("termPlan: unrecognized commitment term %q (accepted: 1yr/1/12mo or 3yr/3/36mo)", term)
5656
}
5757
}
5858

@@ -390,7 +390,7 @@ type CommitmentRequest struct {
390390
// single commitments.insert call.
391391
// Each recommendation's Count is treated as vCPU count; the memory Amount is
392392
// read from ComputeDetails.MemoryGB (populated by extractMemoryMBFromRecommendation).
393-
// Recommendations with an unrecognised term or missing memory are skipped with a
393+
// Recommendations with an unrecognized term or missing memory are skipped with a
394394
// log warning so a bad rec never contaminates an otherwise valid group.
395395
func GroupCommitments(recs []common.Recommendation) []CommitmentRequest {
396396
type key struct{ account, region, term string }
@@ -407,7 +407,7 @@ func GroupCommitments(recs []common.Recommendation) []CommitmentRequest {
407407
}
408408
plan, err := termPlan(rec.Term)
409409
if err != nil {
410-
log.Printf("GroupCommitments: skipping recommendation with unrecognised term %q: %v", rec.Term, err)
410+
log.Printf("GroupCommitments: skipping recommendation with unrecognized term %q: %v", rec.Term, err)
411411
continue
412412
}
413413
recMemMB, err := memoryMBFromDetails(rec)
@@ -903,7 +903,7 @@ func skuMatchesMachineType(sku *cloudbilling.Sku, machineType, region string) bo
903903
// BreakEvenMonths so the scorer can filter and rank GCP recommendations correctly
904904
// (issue #1022 C2). Pricing failures are logged but do not discard the recommendation:
905905
// EstimatedSavings from the Recommender payload is the authoritative savings signal.
906-
// Returns nil when the params.Term is unrecognised so the caller skips an
906+
// Returns nil when the params.Term is unrecognized so the caller skips an
907907
// unroutable recommendation rather than queuing a purchase with an invalid plan.
908908
func (c *ComputeEngineClient) convertGCPRecommendation(ctx context.Context, gcpRec *recommenderpb.Recommendation, params common.RecommendationParams) *common.Recommendation {
909909
// GCP CUDs are billed monthly with no upfront option; force "monthly"
@@ -917,13 +917,13 @@ func (c *ComputeEngineClient) convertGCPRecommendation(ctx context.Context, gcpR
917917
paymentOption := "monthly"
918918

919919
// H-3: propagate params.Term (default "1yr") and validate it so an
920-
// unrecognised term fails loud here rather than reaching buildInsertRequest.
920+
// unrecognized term fails loud here rather than reaching buildInsertRequest.
921921
term := params.Term
922922
if term == "" {
923923
term = "1yr"
924924
}
925925
if _, err := termPlan(term); err != nil {
926-
log.Printf("computeengine: skipping recommendation with unrecognised term %q: %v", term, err)
926+
log.Printf("computeengine: skipping recommendation with unrecognized term %q: %v", term, err)
927927
return nil
928928
}
929929

‎providers/gcp/services/computeengine/client_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ func TestTermPlan_RejectsUnknownTerm(t *testing.T) {
14351435
for _, badTerm := range []string{"", "2yr", "invalid", "24mo", "forever"} {
14361436
_, err := termPlan(badTerm)
14371437
require.Error(t, err, "termPlan must reject unrecognized term %q (no silent 12-month default)", badTerm)
1438-
assert.Contains(t, err.Error(), "unrecognised commitment term", //nolint:misspell // matches production error string
1438+
assert.Contains(t, err.Error(), "unrecognized commitment term",
14391439
"error for term %q must identify the bad input", badTerm)
14401440
}
14411441
}

0 commit comments

Comments
 (0)