Skip to content

Fix staticcheck findings in pkg/controller #556

@pallasathena92

Description

@pallasathena92

Summary

staticcheck reports several issues in pkg/controller/... that should be cleaned up.

Findings

U1000 — Unused code (7 instances)

  • pkg/controller/v1beta1/acceleratorclass/controller.go:152matchNodeSelectorTerm
  • pkg/controller/v1beta1/acceleratorclass/controller.go:170matchNodeSelectorExpressions
  • pkg/controller/v1beta1/acceleratorclass/controller.go:212matchNodeSelectorFields
  • pkg/controller/v1beta1/acceleratorclass/controller.go:225extractNodeFields
  • pkg/controller/v1beta1/inferenceservice/cleanup.go:140cleanupRemovedComponentsDynamic
  • pkg/controller/v1beta1/inferenceservice/reconcilers/hpa/hpa_reconciler.go:83getDeploymentName
  • pkg/controller/v1beta1/inferenceservice/reconcilers/keda/keda_reconciler.go:104getDeploymentName

ST1019 — Duplicate import (1 instance)

  • pkg/controller/v1beta1/inferenceservice/reconcilers/ingress/strategies/gateway_api_strategy.go:15-16knative.dev/pkg/apis imported twice

SA5011 — Possible nil pointer dereference (1 instance)

  • pkg/controller/v1beta1/inferenceservice/reconcilers/service/service_reconciler_test.go:296 — pointer dereferenced after a nil check on line 293 suggests it can be nil

SA4022 — Address of variable cannot be nil (5 instances)

  • pkg/controller/v1beta1/inferenceservice/utils/merging.go lines 186, 202, 210, 234, 261 — redundant nil checks on variable addresses

Proposed fix

  • Remove unused functions
  • Deduplicate the import
  • Guard or restructure the nil dereference in the test
  • Remove redundant nil-address checks

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions