Skip to content

CNTRLPLANE-4008: feat: add hypershiftlinter golangci-lint plugin - #9237

Open
bryan-cox wants to merge 3 commits into
openshift:mainfrom
bryan-cox:worktree-hypershiftlinter-plugin
Open

CNTRLPLANE-4008: feat: add hypershiftlinter golangci-lint plugin#9237
bryan-cox wants to merge 3 commits into
openshift:mainfrom
bryan-cox:worktree-hypershiftlinter-plugin

Conversation

@bryan-cox

@bryan-cox bryan-cox commented Aug 6, 2026

Copy link
Copy Markdown
Member

What this PR does / why we need it:

Adds a golangci-lint v2 Go plugin (hypershiftlinter) that enforces test conventions from TESTING.md and test/e2e/v2/AGENTS.md via static analysis, and fixes all existing violations.

Commit 1 — Plugin:

7 analyzers split by scope:

  • TESTING.md (unit tests only): testcasename, testfuncname
  • AGENTS.md (test/e2e/v2/ only): guestcluster, contextbackground, vacuouspass, ipv6url, sippyannotation

Enabled by default in .golangci.yml, runs as part of make lint. Makefile tracks plugin source files so the .so is rebuilt when analyzer code changes.

GHA lint workflow updated to cache hack/tools/bin/ (keyed on Makefile + go.mod + go.sum + plugin source) instead of copying pre-built tools from the runner image, which caused version mismatch errors when loading the plugin.

Commit 2 — Fix violations:

Mechanical rename of test case name fields across 98 files to "When <condition> it should <expected behavior>" format, plus Test_ to TestCamelCase renames.

Commit 3 — Temporary (squash before merge):

Points lint.yaml caller at this branch's lint-reusable.yaml so the workflow changes can be tested in CI before merge. Must be reverted to @main before merging.

Which issue(s) this PR fixes:

Fixes CNTRLPLANE-4008

Special notes for your reviewer:

  • The plugin builds as a Go shared library (.so) using CGO_ENABLED=1 -buildmode=plugin
  • Plugin and golangci-lint host binary must be compiled from the same hack/tools/go.mod — the pre-built tools on the runner image have a different golang.org/x/tools version, causing plugin.Open() to fail. The workflow change from pre-built copy to source build + cache fixes this.
  • Analyzers are correctly scoped: TESTING.md rules only fire on unit tests (not e2e/integration), AGENTS.md rules only fire on test/e2e/v2/ files
  • The test rename commit is purely mechanical — no logic changes
  • make lint passes clean with 0 hypershiftlinter violations
  • Commit 3 must be squashed/reverted before merge — it temporarily points the lint caller at this branch to test workflow changes

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 6, 2026
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci openshift-ci Bot added do-not-merge/needs-area needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds the hypershiftlinter plugin, its analyzers, and the lint wiring needed to build and run it. It updates golangci-lint and workflow tooling to use the plugin. It also renames test functions and table-driven test cases across multiple packages to use clearer, idiomatic names. Test logic and production behavior are unchanged.

Sequence Diagram(s)

sequenceDiagram
  participant Makefile
  participant GolangCILint
  participant HypershiftLinter
  participant GoTests
  Makefile->>GolangCILint: build plugin and run lint
  GolangCILint->>HypershiftLinter: load analyzers
  HypershiftLinter->>GoTests: inspect test files
  GoTests-->>HypershiftLinter: AST and test names
  HypershiftLinter-->>GolangCILint: diagnostics
Loading
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

@openshift-ci openshift-ci Bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. area/ci-tooling Indicates the PR includes changes for CI or tooling area/cli Indicates the PR includes changes for CLI area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/control-plane-pki-operator Indicates the PR includes changes for the control plane PKI operator - in an OCP release area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/platform/aws PR/issue for AWS (AWSPlatform) platform area/platform/azure PR/issue for Azure (AzurePlatform) platform area/platform/gcp PR/issue for GCP (GCPPlatform) platform area/platform/kubevirt PR/issue for KubeVirt (KubevirtPlatform) platform area/platform/none PR/issue for None (NonePlatform) platform - user-supplied infrastructure area/platform/openstack PR/issue for OpenStack (OpenStackPlatform) platform area/platform/powervs PR/issue for PowerVS (PowerVSPlatform) platform and removed do-not-merge/needs-area labels Aug 6, 2026
@bryan-cox
bryan-cox force-pushed the worktree-hypershiftlinter-plugin branch from 4d80587 to d2da990 Compare August 6, 2026 09:43
@openshift-ci openshift-ci Bot added area/api Indicates the PR includes changes for the API area/documentation Indicates the PR includes changes for documentation area/testing Indicates the PR includes changes for e2e testing and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Aug 6, 2026
@bryan-cox
bryan-cox force-pushed the worktree-hypershiftlinter-plugin branch from d2da990 to a2056a8 Compare August 6, 2026 09:43
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 6, 2026
@bryan-cox bryan-cox changed the title feat: add hypershiftlinter golangci-lint plugin fix(tests): align unit test naming with TESTING.md conventions Aug 6, 2026
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bryan-cox

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 6, 2026
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@hack/tools/hypershiftlinter/analyzers/sippyannotation/sippyannotation.go`:
- Around line 48-54: Update the annotation check in the Describe validation flow
around strings.Contains so it recognizes only complete [Feature:X] annotations
with a non-empty X and a closing ]. Preserve the existing hasFeatureInChildren
fallback and diagnostic behavior for names lacking a valid annotation.
- Around line 112-123: Update hasFeatureInChildren to inspect every eligible
child Context, When, or Register*Tests call instead of returning after the first
match. Track whether all eligible children have valid feature annotations, and
reject the enclosing Describe when any child is unannotated; preserve the
existing behavior for recognized annotated children.

In `@hack/tools/hypershiftlinter/analyzers/vacuouspass/vacuouspass.go`:
- Around line 116-149: Update hasBeEmptyInBeforeEach to resolve the enclosing
Ginkgo container for target and restrict matching BeforeEach registrations to
that scope, including only setup inherited by the loop and excluding sibling
Describe or Context branches. Preserve the existing containsExpectAndBeEmpty
check while using the enclosing scope rather than only nodeString(target) to
determine a match.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: ce79a5fc-1c8e-4e8f-8adf-aa0a3a8faa3c

📥 Commits

Reviewing files that changed from the base of the PR and between 1d48188 and 5936c0d.

📒 Files selected for processing (111)
  • .golangci.yml
  • Makefile
  • cmd/cluster/agent/create_test.go
  • cmd/cluster/aws/create_test.go
  • cmd/cluster/aws/destroy_test.go
  • cmd/cluster/azure/create_test.go
  • cmd/cluster/core/create_test.go
  • cmd/cluster/core/dump_test.go
  • cmd/cluster/gcp/create_test.go
  • cmd/cluster/kubevirt/create_test.go
  • cmd/cluster/none/create_test.go
  • cmd/cluster/openstack/create_test.go
  • cmd/cluster/powervs/create_test.go
  • cmd/nodepool/aws/create_test.go
  • cmd/nodepool/azure/create_test.go
  • cmd/nodepool/kubevirt/create_test.go
  • cmd/nodepool/openstack/create_test.go
  • cmd/oadp/backup_test.go
  • cmd/oadp/common_test.go
  • cmd/oadp/restore_test.go
  • cmd/oadp/schedule_test.go
  • cmd/util/azure_test.go
  • cmd/util/params_test.go
  • control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller_test.go
  • control-plane-operator/controllers/azureprivatelinkservice/observer_test.go
  • control-plane-operator/controllers/gcpprivateserviceconnect/observer_test.go
  • control-plane-operator/controllers/hostedcontrolplane/creatorupdate_ownerref_enforcer_test.go
  • control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller_test.go
  • control-plane-operator/controllers/hostedcontrolplane/infra/infra_test.go
  • control-plane-operator/controllers/hostedcontrolplane/pki/kas_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/autoscaler/component_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/etcd/etcd_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/karpenter/component_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/config_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/params_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/globalps/globalps_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/globalps/setup_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/inplaceupgrader/inplaceupgrader_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/ingress/params_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.go
  • control-plane-pki-operator/certificaterevocationcontroller/certificaterevocationcontroller_test.go
  • control-plane-pki-operator/certificatesigningcontroller/certificatesigningcontroller_test.go
  • hack/tools/go.mod
  • hack/tools/hypershiftlinter/analyzers/contextbackground/contextbackground.go
  • hack/tools/hypershiftlinter/analyzers/guestcluster/guestcluster.go
  • hack/tools/hypershiftlinter/analyzers/ipv6url/ipv6url.go
  • hack/tools/hypershiftlinter/analyzers/pathutil/pathutil.go
  • hack/tools/hypershiftlinter/analyzers/sippyannotation/sippyannotation.go
  • hack/tools/hypershiftlinter/analyzers/testcasename/testcasename.go
  • hack/tools/hypershiftlinter/analyzers/testfuncname/testfuncname.go
  • hack/tools/hypershiftlinter/analyzers/vacuouspass/vacuouspass.go
  • hack/tools/hypershiftlinter/cmd/plugin/main.go
  • hack/tools/hypershiftlinter/plugin.go
  • hypershift-operator/controllers/hostedcluster/createorupdate_annotation_enforcer_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_webhook_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/aws/aws_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/azure/azure_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/openstack/openstack_test.go
  • hypershift-operator/controllers/hostedcluster/karpenter_test.go
  • hypershift-operator/controllers/hostedcluster/metrics/metrics_test.go
  • hypershift-operator/controllers/hostedcluster/security_context_uid_test.go
  • hypershift-operator/controllers/hostedcluster/validations/ocpapiserver_test.go
  • hypershift-operator/controllers/hostedclustersizing/hostedclustersizing_controller_test.go
  • hypershift-operator/controllers/nodepool/aws_test.go
  • hypershift-operator/controllers/nodepool/capi_test.go
  • hypershift-operator/controllers/nodepool/config_test.go
  • hypershift-operator/controllers/nodepool/instancetype/aws/provider_test.go
  • hypershift-operator/controllers/nodepool/kubevirt/kubevirt_test.go
  • hypershift-operator/controllers/nodepool/nodepool_controller_test.go
  • hypershift-operator/controllers/nodepool/nto_test.go
  • hypershift-operator/controllers/nodepool/openstack/openstack_test.go
  • hypershift-operator/controllers/nodepool/secret_janitor_test.go
  • hypershift-operator/controllers/platform/aws/controller_test.go
  • hypershift-operator/controllers/platform/gcp/privateserviceconnect_controller_test.go
  • hypershift-operator/controllers/scheduler/aws/autoscaler_test.go
  • hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go
  • hypershift-operator/controllers/scheduler/aws/placeholders_test.go
  • hypershift-operator/controllers/scheduler/azure/controllers_test.go
  • hypershift-operator/controllers/scheduler/util/scheduler_test.go
  • hypershift-operator/controllers/sharedingress/router_test.go
  • hypershift-operator/controllers/uwmtelemetry/uwm_telemetry_test.go
  • hypershift-operator/featuregate/feature_test.go
  • ignition-server/controllers/tokensecret_controller_test.go
  • kas-bootstrap/kas_boostrap_test.go
  • pkg/etcdcli/health_test.go
  • pkg/featuregates/featuregates_test.go
  • support/azureutil/azureutil_test.go
  • support/backwardcompat/backwardcompat_test.go
  • support/catalogs/images_test.go
  • support/config/resources_test.go
  • support/etcd/shards_test.go
  • support/events/message_test.go
  • support/forwarder/forwarder_test.go
  • support/karpenter/karpenter_test.go
  • support/konnectivityproxy/dialer_test.go
  • support/netutil/iputil_test.go
  • support/netutil/networking_test.go
  • support/netutil/public_test.go
  • support/oadp/validate_test.go
  • support/openstackutil/conversion_test.go
  • support/podspec/containers_test.go
  • support/proxy/proxy_test.go
  • support/releaseinfo/registryclient/client_test.go
  • support/secretproviderclass/secretproviderclass_test.go
  • support/supportedversion/version_test.go
  • support/util/cleanup_tracker_test.go
  • support/util/maps_test.go
  • support/util/registryoverride/registryoverride_test.go
  • support/util/util_test.go
  • sync-global-pullsecret/sync-global-pullsecret_test.go
🚧 Files skipped from review as they are similar to previous changes (107)
  • hypershift-operator/controllers/sharedingress/router_test.go
  • support/backwardcompat/backwardcompat_test.go
  • hypershift-operator/featuregate/feature_test.go
  • support/openstackutil/conversion_test.go
  • support/config/resources_test.go
  • cmd/cluster/agent/create_test.go
  • hypershift-operator/controllers/hostedcluster/security_context_uid_test.go
  • hypershift-operator/controllers/scheduler/azure/controllers_test.go
  • cmd/cluster/gcp/create_test.go
  • support/catalogs/images_test.go
  • cmd/cluster/core/dump_test.go
  • hack/tools/hypershiftlinter/analyzers/pathutil/pathutil.go
  • support/netutil/iputil_test.go
  • cmd/oadp/restore_test.go
  • hypershift-operator/controllers/nodepool/config_test.go
  • cmd/oadp/common_test.go
  • hypershift-operator/controllers/hostedcluster/validations/ocpapiserver_test.go
  • support/events/message_test.go
  • control-plane-operator/controllers/hostedcontrolplane/creatorupdate_ownerref_enforcer_test.go
  • hack/tools/go.mod
  • cmd/oadp/backup_test.go
  • hypershift-operator/controllers/hostedcluster/karpenter_test.go
  • support/azureutil/azureutil_test.go
  • support/util/cleanup_tracker_test.go
  • support/util/maps_test.go
  • support/etcd/shards_test.go
  • hack/tools/hypershiftlinter/cmd/plugin/main.go
  • hack/tools/hypershiftlinter/analyzers/guestcluster/guestcluster.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/globalps/setup_test.go
  • cmd/cluster/powervs/create_test.go
  • hypershift-operator/controllers/hostedcluster/createorupdate_annotation_enforcer_test.go
  • hack/tools/hypershiftlinter/analyzers/contextbackground/contextbackground.go
  • hypershift-operator/controllers/uwmtelemetry/uwm_telemetry_test.go
  • cmd/nodepool/openstack/create_test.go
  • cmd/nodepool/azure/create_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/openstack/openstack_test.go
  • cmd/cluster/aws/create_test.go
  • support/forwarder/forwarder_test.go
  • support/netutil/public_test.go
  • cmd/cluster/kubevirt/create_test.go
  • cmd/cluster/openstack/create_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/inplaceupgrader/inplaceupgrader_test.go
  • control-plane-operator/controllers/azureprivatelinkservice/observer_test.go
  • ignition-server/controllers/tokensecret_controller_test.go
  • kas-bootstrap/kas_boostrap_test.go
  • hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go
  • support/secretproviderclass/secretproviderclass_test.go
  • hypershift-operator/controllers/hostedclustersizing/hostedclustersizing_controller_test.go
  • support/proxy/proxy_test.go
  • support/karpenter/karpenter_test.go
  • support/releaseinfo/registryclient/client_test.go
  • cmd/cluster/azure/create_test.go
  • hypershift-operator/controllers/scheduler/aws/autoscaler_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/aws/aws_test.go
  • .golangci.yml
  • cmd/nodepool/aws/create_test.go
  • support/supportedversion/version_test.go
  • hypershift-operator/controllers/scheduler/util/scheduler_test.go
  • control-plane-pki-operator/certificatesigningcontroller/certificatesigningcontroller_test.go
  • hypershift-operator/controllers/hostedcluster/metrics/metrics_test.go
  • hypershift-operator/controllers/nodepool/secret_janitor_test.go
  • control-plane-operator/controllers/hostedcontrolplane/pki/kas_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/karpenter/component_test.go
  • pkg/etcdcli/health_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/azure/azure_test.go
  • hack/tools/hypershiftlinter/analyzers/ipv6url/ipv6url.go
  • support/netutil/networking_test.go
  • support/util/registryoverride/registryoverride_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/ingress/params_test.go
  • control-plane-operator/controllers/gcpprivateserviceconnect/observer_test.go
  • hypershift-operator/controllers/nodepool/nto_test.go
  • hack/tools/hypershiftlinter/plugin.go
  • hypershift-operator/controllers/nodepool/openstack/openstack_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/etcd/etcd_test.go
  • support/konnectivityproxy/dialer_test.go
  • cmd/oadp/schedule_test.go
  • cmd/cluster/none/create_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_webhook_test.go
  • cmd/cluster/core/create_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/autoscaler/component_test.go
  • hypershift-operator/controllers/platform/gcp/privateserviceconnect_controller_test.go
  • hypershift-operator/controllers/platform/aws/controller_test.go
  • control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller_test.go
  • cmd/nodepool/kubevirt/create_test.go
  • hack/tools/hypershiftlinter/analyzers/testcasename/testcasename.go
  • control-plane-operator/controllers/hostedcontrolplane/infra/infra_test.go
  • cmd/cluster/aws/destroy_test.go
  • cmd/util/azure_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/config_test.go
  • cmd/util/params_test.go
  • hypershift-operator/controllers/nodepool/kubevirt/kubevirt_test.go
  • control-plane-pki-operator/certificaterevocationcontroller/certificaterevocationcontroller_test.go
  • hypershift-operator/controllers/nodepool/instancetype/aws/provider_test.go
  • hack/tools/hypershiftlinter/analyzers/testfuncname/testfuncname.go
  • support/util/util_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/globalps/globalps_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/params_test.go
  • hypershift-operator/controllers/nodepool/aws_test.go
  • support/oadp/validate_test.go
  • hypershift-operator/controllers/nodepool/capi_test.go
  • support/podspec/containers_test.go
  • hypershift-operator/controllers/nodepool/nodepool_controller_test.go
  • pkg/featuregates/featuregates_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.go
  • control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller_test.go
  • hypershift-operator/controllers/scheduler/aws/placeholders_test.go

Comment thread hack/tools/hypershiftlinter/analyzers/sippyannotation/sippyannotation.go Outdated
Comment thread hack/tools/hypershiftlinter/analyzers/vacuouspass/vacuouspass.go Outdated
@bryan-cox
bryan-cox force-pushed the worktree-hypershiftlinter-plugin branch from 5936c0d to c20ed6d Compare August 6, 2026 11:06
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@bryan-cox
bryan-cox force-pushed the worktree-hypershiftlinter-plugin branch from c20ed6d to 502271b Compare August 6, 2026 11:33
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@bryan-cox
bryan-cox force-pushed the worktree-hypershiftlinter-plugin branch from 502271b to bbcbec4 Compare August 6, 2026 11:44

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/lint-reusable.yaml:
- Around line 23-26: Update the cache key for the hack/tools/bin cache in the
lint workflow to include hashes of all lint build inputs, including
hack/tools/go.mod and Makefile alongside the existing go.sum and
hypershiftlinter sources. Preserve the existing cache path and key prefix while
ensuring changes to module or build rules invalidate cached binaries.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 14924d7a-1586-4310-b3d4-9b8236e6703e

📥 Commits

Reviewing files that changed from the base of the PR and between c183e79 and 502271b.

⛔ Files ignored due to path filters (47)
  • cmd/cluster/agent/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/cluster/aws/testdata/zz_fixture_TestCreateCluster_When_KubeAPIServerDNSName_is_provided__it_should_configure_custom_DNS_name.yaml is excluded by !**/testdata/**
  • cmd/cluster/aws/testdata/zz_fixture_TestCreateCluster_When_OVNKubernetesMTU_is_provided__it_should_configure_custom_MTU.yaml is excluded by !**/testdata/**
  • cmd/cluster/aws/testdata/zz_fixture_TestCreateCluster_When_default_creation_flags_are_provided__it_should_create_cluster_with_expected_configuration.yaml is excluded by !**/testdata/**
  • cmd/cluster/aws/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_Azure_Marketplace_image_flags_are_provided__it_should_configure_marketplace_image.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_KubeAPIServerDNSName_is_provided__it_should_configure_custom_DNS_name.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_availability_zones_and_image_generation_Gen1_are_provided__it_should_configure_zones_with_Gen1.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_availability_zones_are_provided__it_should_configure_zones.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_complex_configuration_flags_are_provided__it_should_create_cluster_with_all_options.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_disabled_capabilities_are_provided__it_should_configure_disabled_capabilities.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_endpoint_access_is_Private_with_private_flags__it_should_configure_private_endpoint_access.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_image_generation_Gen1_is_provided__it_should_configure_Gen1_images.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_image_generation_Gen2_is_provided__it_should_configure_Gen2_images.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_marketplace_flags_and_image_generation_Gen1_are_provided__it_should_configure_marketplace_with_Gen1.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_oauth_publishing_strategy_is_LoadBalancer__it_should_configure_OAuth_LoadBalancer.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_create_with_a_ure_marketplace_image.yaml is excluded by !**/testdata/**
  • cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_with_availability_ones.yaml is excluded by !**/testdata/**
  • cmd/cluster/gcp/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/cluster/kubevirt/testdata/zz_fixture_TestCreateCluster_When_complex_configuration_flags_are_provided__it_should_create_cluster_with_all_options.yaml is excluded by !**/testdata/**
  • cmd/cluster/kubevirt/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/cluster/none/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/cluster/openstack/testdata/zz_fixture_TestCreateCluster_When_default_creation_flags_are_provided_it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/cluster/openstack/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided_it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/cluster/powervs/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided_it_should_render_successfully.yaml is excluded by !**/testdata/**
  • cmd/nodepool/aws/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_custom_root_volume_configuration_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/aws/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_full_configuration_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/aws/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_minimal_configuration_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/azure/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_full_configuration_with_Gen2_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/azure/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_minimal_configuration_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/kubevirt/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_full_configuration_with_additional_networks_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/kubevirt/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_host_devices_are_configured_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/kubevirt/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_minimal_configuration_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/openstack/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_full_configuration_with_availability_zone_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • cmd/nodepool/openstack/testdata/zz_fixture_TestCreateNodePool_When_flags_are_parsed_it_should_generate_correct_nodepool_When_minimal_configuration_is_provided_it_should_generate_correct_nodepool.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_ARO_cluster_uses_Swift_with_private_topology__it_should_not_need_routers.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_ARO_cluster_uses_Swift_with_public_and_private_topology__it_should_use_shared_ingress.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_ARO_cluster_uses_shared_ingress_with_annotation_fallback__it_should_use_direct_hostname_without_routers.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_AWS_private_cluster_uses_KAS_LoadBalancer__it_should_configure_internal_router.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_AWS_private_cluster_uses_Route__it_should_configure_internal_router.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_AWS_public_and_private_cluster_uses_KAS_LoadBalancer__it_should_configure_internal_router_only.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_AWS_public_and_private_cluster_uses_Route__it_should_configure_both_routers.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_AWS_public_cluster_uses_KAS_LoadBalancer__it_should_not_need_external_router.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_AWS_public_cluster_uses_Route__it_should_configure_external_router.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_Azure_private_cluster_uses_KAS_LoadBalancer__it_should_configure_internal_router.yaml is excluded by !**/testdata/**
  • control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_Azure_private_cluster_uses_OAuth_LoadBalancer__it_should_configure_internal_router.yaml is excluded by !**/testdata/**
📒 Files selected for processing (112)
  • .github/workflows/lint-reusable.yaml
  • .golangci.yml
  • Makefile
  • cmd/cluster/agent/create_test.go
  • cmd/cluster/aws/create_test.go
  • cmd/cluster/aws/destroy_test.go
  • cmd/cluster/azure/create_test.go
  • cmd/cluster/core/create_test.go
  • cmd/cluster/core/dump_test.go
  • cmd/cluster/gcp/create_test.go
  • cmd/cluster/kubevirt/create_test.go
  • cmd/cluster/none/create_test.go
  • cmd/cluster/openstack/create_test.go
  • cmd/cluster/powervs/create_test.go
  • cmd/nodepool/aws/create_test.go
  • cmd/nodepool/azure/create_test.go
  • cmd/nodepool/kubevirt/create_test.go
  • cmd/nodepool/openstack/create_test.go
  • cmd/oadp/backup_test.go
  • cmd/oadp/common_test.go
  • cmd/oadp/restore_test.go
  • cmd/oadp/schedule_test.go
  • cmd/util/azure_test.go
  • cmd/util/params_test.go
  • control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller_test.go
  • control-plane-operator/controllers/azureprivatelinkservice/observer_test.go
  • control-plane-operator/controllers/gcpprivateserviceconnect/observer_test.go
  • control-plane-operator/controllers/hostedcontrolplane/creatorupdate_ownerref_enforcer_test.go
  • control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller_test.go
  • control-plane-operator/controllers/hostedcontrolplane/infra/infra_test.go
  • control-plane-operator/controllers/hostedcontrolplane/pki/kas_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/autoscaler/component_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/etcd/etcd_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/karpenter/component_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/config_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/params_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/globalps/globalps_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/globalps/setup_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/inplaceupgrader/inplaceupgrader_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/ingress/params_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.go
  • control-plane-pki-operator/certificaterevocationcontroller/certificaterevocationcontroller_test.go
  • control-plane-pki-operator/certificatesigningcontroller/certificatesigningcontroller_test.go
  • hack/tools/go.mod
  • hack/tools/hypershiftlinter/analyzers/contextbackground/contextbackground.go
  • hack/tools/hypershiftlinter/analyzers/guestcluster/guestcluster.go
  • hack/tools/hypershiftlinter/analyzers/ipv6url/ipv6url.go
  • hack/tools/hypershiftlinter/analyzers/pathutil/pathutil.go
  • hack/tools/hypershiftlinter/analyzers/sippyannotation/sippyannotation.go
  • hack/tools/hypershiftlinter/analyzers/testcasename/testcasename.go
  • hack/tools/hypershiftlinter/analyzers/testfuncname/testfuncname.go
  • hack/tools/hypershiftlinter/analyzers/vacuouspass/vacuouspass.go
  • hack/tools/hypershiftlinter/cmd/plugin/main.go
  • hack/tools/hypershiftlinter/plugin.go
  • hypershift-operator/controllers/hostedcluster/createorupdate_annotation_enforcer_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_webhook_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/aws/aws_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/azure/azure_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/openstack/openstack_test.go
  • hypershift-operator/controllers/hostedcluster/karpenter_test.go
  • hypershift-operator/controllers/hostedcluster/metrics/metrics_test.go
  • hypershift-operator/controllers/hostedcluster/security_context_uid_test.go
  • hypershift-operator/controllers/hostedcluster/validations/ocpapiserver_test.go
  • hypershift-operator/controllers/hostedclustersizing/hostedclustersizing_controller_test.go
  • hypershift-operator/controllers/nodepool/aws_test.go
  • hypershift-operator/controllers/nodepool/capi_test.go
  • hypershift-operator/controllers/nodepool/config_test.go
  • hypershift-operator/controllers/nodepool/instancetype/aws/provider_test.go
  • hypershift-operator/controllers/nodepool/kubevirt/kubevirt_test.go
  • hypershift-operator/controllers/nodepool/nodepool_controller_test.go
  • hypershift-operator/controllers/nodepool/nto_test.go
  • hypershift-operator/controllers/nodepool/openstack/openstack_test.go
  • hypershift-operator/controllers/nodepool/secret_janitor_test.go
  • hypershift-operator/controllers/platform/aws/controller_test.go
  • hypershift-operator/controllers/platform/gcp/privateserviceconnect_controller_test.go
  • hypershift-operator/controllers/scheduler/aws/autoscaler_test.go
  • hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go
  • hypershift-operator/controllers/scheduler/aws/placeholders_test.go
  • hypershift-operator/controllers/scheduler/azure/controllers_test.go
  • hypershift-operator/controllers/scheduler/util/scheduler_test.go
  • hypershift-operator/controllers/sharedingress/router_test.go
  • hypershift-operator/controllers/uwmtelemetry/uwm_telemetry_test.go
  • hypershift-operator/featuregate/feature_test.go
  • ignition-server/controllers/tokensecret_controller_test.go
  • kas-bootstrap/kas_boostrap_test.go
  • pkg/etcdcli/health_test.go
  • pkg/featuregates/featuregates_test.go
  • support/azureutil/azureutil_test.go
  • support/backwardcompat/backwardcompat_test.go
  • support/catalogs/images_test.go
  • support/config/resources_test.go
  • support/etcd/shards_test.go
  • support/events/message_test.go
  • support/forwarder/forwarder_test.go
  • support/karpenter/karpenter_test.go
  • support/konnectivityproxy/dialer_test.go
  • support/netutil/iputil_test.go
  • support/netutil/networking_test.go
  • support/netutil/public_test.go
  • support/oadp/validate_test.go
  • support/openstackutil/conversion_test.go
  • support/podspec/containers_test.go
  • support/proxy/proxy_test.go
  • support/releaseinfo/registryclient/client_test.go
  • support/secretproviderclass/secretproviderclass_test.go
  • support/supportedversion/version_test.go
  • support/util/cleanup_tracker_test.go
  • support/util/maps_test.go
  • support/util/registryoverride/registryoverride_test.go
  • support/util/util_test.go
  • sync-global-pullsecret/sync-global-pullsecret_test.go
🚧 Files skipped from review as they are similar to previous changes (110)
  • cmd/cluster/gcp/create_test.go
  • cmd/oadp/restore_test.go
  • hypershift-operator/controllers/sharedingress/router_test.go
  • control-plane-operator/controllers/hostedcontrolplane/pki/kas_test.go
  • support/events/message_test.go
  • hypershift-operator/featuregate/feature_test.go
  • support/backwardcompat/backwardcompat_test.go
  • cmd/cluster/agent/create_test.go
  • support/catalogs/images_test.go
  • support/netutil/iputil_test.go
  • cmd/cluster/core/dump_test.go
  • support/releaseinfo/registryclient/client_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/config_test.go
  • support/config/resources_test.go
  • hack/tools/hypershiftlinter/cmd/plugin/main.go
  • support/util/maps_test.go
  • support/openstackutil/conversion_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/karpenter/component_test.go
  • cmd/cluster/core/create_test.go
  • cmd/cluster/none/create_test.go
  • hack/tools/go.mod
  • control-plane-operator/controllers/hostedcontrolplane/v2/autoscaler/component_test.go
  • hypershift-operator/controllers/hostedcluster/createorupdate_annotation_enforcer_test.go
  • hypershift-operator/controllers/nodepool/secret_janitor_test.go
  • support/forwarder/forwarder_test.go
  • support/util/cleanup_tracker_test.go
  • control-plane-operator/controllers/hostedcontrolplane/creatorupdate_ownerref_enforcer_test.go
  • support/secretproviderclass/secretproviderclass_test.go
  • hack/tools/hypershiftlinter/analyzers/testfuncname/testfuncname.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/ingress/params_test.go
  • hypershift-operator/controllers/hostedcluster/karpenter_test.go
  • cmd/oadp/schedule_test.go
  • hypershift-operator/controllers/nodepool/config_test.go
  • hack/tools/hypershiftlinter/analyzers/ipv6url/ipv6url.go
  • pkg/etcdcli/health_test.go
  • pkg/featuregates/featuregates_test.go
  • hypershift-operator/controllers/nodepool/openstack/openstack_test.go
  • cmd/cluster/aws/destroy_test.go
  • control-plane-operator/controllers/gcpprivateserviceconnect/observer_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/openstack/openstack_test.go
  • control-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller_test.go
  • cmd/cluster/powervs/create_test.go
  • hack/tools/hypershiftlinter/analyzers/guestcluster/guestcluster.go
  • hypershift-operator/controllers/hostedcluster/validations/ocpapiserver_test.go
  • support/netutil/public_test.go
  • support/proxy/proxy_test.go
  • control-plane-operator/controllers/awsprivatelink/awsprivatelink_controller_test.go
  • cmd/oadp/backup_test.go
  • support/oadp/validate_test.go
  • hack/tools/hypershiftlinter/analyzers/vacuouspass/vacuouspass.go
  • support/azureutil/azureutil_test.go
  • cmd/nodepool/azure/create_test.go
  • .golangci.yml
  • cmd/cluster/aws/create_test.go
  • cmd/oadp/common_test.go
  • hypershift-operator/controllers/nodepool/aws_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/globalps/setup_test.go
  • hack/tools/hypershiftlinter/analyzers/pathutil/pathutil.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/kas/params_test.go
  • hypershift-operator/controllers/nodepool/instancetype/aws/provider_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/aws/aws_test.go
  • hack/tools/hypershiftlinter/analyzers/contextbackground/contextbackground.go
  • hypershift-operator/controllers/scheduler/aws/autoscaler_test.go
  • hack/tools/hypershiftlinter/analyzers/testcasename/testcasename.go
  • cmd/cluster/kubevirt/create_test.go
  • control-plane-operator/controllers/hostedcontrolplane/v2/etcd/etcd_test.go
  • cmd/cluster/openstack/create_test.go
  • hypershift-operator/controllers/platform/aws/controller_test.go
  • ignition-server/controllers/tokensecret_controller_test.go
  • control-plane-operator/controllers/hostedcontrolplane/infra/infra_test.go
  • cmd/util/params_test.go
  • control-plane-operator/controllers/azureprivatelinkservice/observer_test.go
  • hypershift-operator/controllers/hostedcluster/security_context_uid_test.go
  • hypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.go
  • kas-bootstrap/kas_boostrap_test.go
  • support/konnectivityproxy/dialer_test.go
  • support/supportedversion/version_test.go
  • hypershift-operator/controllers/hostedclustersizing/hostedclustersizing_controller_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/globalps/globalps_test.go
  • hypershift-operator/controllers/scheduler/azure/controllers_test.go
  • support/netutil/networking_test.go
  • hack/tools/hypershiftlinter/plugin.go
  • Makefile
  • cmd/cluster/azure/create_test.go
  • hypershift-operator/controllers/uwmtelemetry/uwm_telemetry_test.go
  • support/util/util_test.go
  • hack/tools/hypershiftlinter/analyzers/sippyannotation/sippyannotation.go
  • control-plane-pki-operator/certificaterevocationcontroller/certificaterevocationcontroller_test.go
  • cmd/nodepool/kubevirt/create_test.go
  • support/podspec/containers_test.go
  • cmd/util/azure_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/inplaceupgrader/inplaceupgrader_test.go
  • hypershift-operator/controllers/nodepool/capi_test.go
  • cmd/nodepool/aws/create_test.go
  • hypershift-operator/controllers/hostedcluster/internal/platform/azure/azure_test.go
  • cmd/nodepool/openstack/create_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_webhook_test.go
  • hypershift-operator/controllers/nodepool/kubevirt/kubevirt_test.go
  • hypershift-operator/controllers/hostedcluster/metrics/metrics_test.go
  • hypershift-operator/controllers/scheduler/util/scheduler_test.go
  • support/util/registryoverride/registryoverride_test.go
  • control-plane-pki-operator/certificatesigningcontroller/certificatesigningcontroller_test.go
  • support/karpenter/karpenter_test.go
  • hypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.go
  • hypershift-operator/controllers/platform/gcp/privateserviceconnect_controller_test.go
  • hypershift-operator/controllers/scheduler/aws/placeholders_test.go
  • hypershift-operator/controllers/nodepool/nto_test.go
  • support/etcd/shards_test.go
  • control-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.go
  • hypershift-operator/controllers/nodepool/nodepool_controller_test.go

Comment thread .github/workflows/lint-reusable.yaml Outdated
@bryan-cox
bryan-cox force-pushed the worktree-hypershiftlinter-plugin branch 2 times, most recently from 2aae996 to 183ea26 Compare August 6, 2026 12:28
@bryan-cox bryan-cox changed the title feat: add hypershiftlinter golangci-lint plugin CNTRLPLANE-4008: feat: add hypershiftlinter golangci-lint plugin Aug 6, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Aug 6, 2026
@openshift-ci-robot

openshift-ci-robot commented Aug 6, 2026

Copy link
Copy Markdown

@bryan-cox: This pull request references CNTRLPLANE-4008 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

What this PR does / why we need it:

Adds a golangci-lint v2 Go plugin (hypershiftlinter) that enforces test conventions from TESTING.md and test/e2e/v2/AGENTS.md via static analysis, and fixes all existing violations.

Commit 1 — Plugin:

7 analyzers split by scope:

  • TESTING.md (unit tests only): testcasename, testfuncname
  • AGENTS.md (test/e2e/v2/ only): guestcluster, contextbackground, vacuouspass, ipv6url, sippyannotation

Enabled by default in .golangci.yml, runs as part of make lint. Makefile tracks plugin source files so the .so is rebuilt when analyzer code changes.

Commit 2 — Fix violations:

Mechanical rename of test case name fields across 98 files to "When <condition> it should <expected behavior>" format, plus Test_ to TestCamelCase renames.

Which issue(s) this PR fixes:

Special notes for your reviewer:

  • The plugin builds as a Go shared library (.so) using CGO_ENABLED=1 -buildmode=plugin
  • Analyzers are correctly scoped: TESTING.md rules only fire on unit tests (not e2e/integration), AGENTS.md rules only fire on test/e2e/v2/ files
  • The test rename commit is purely mechanical — no logic changes
  • make lint passes clean with 0 hypershiftlinter violations

Checklist:

  • Subject and description added to both, commit and PR.
  • Relevant issues have been referenced.
  • This change includes docs.
  • This change includes unit tests.

Summary by CodeRabbit

  • New Features

  • Added custom linting checks for test names, annotations, context usage, IPv6-safe URLs, terminology, and assertions.

  • Integrated these checks into the standard lint workflow, with an option to run them independently.

  • Tests

  • Improved test descriptions and naming consistency across the codebase.

  • Added automated validation for clearer test conventions and end-to-end testing practices.

  • Chores

  • Improved lint workflow efficiency by caching lint tooling between runs.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@bryan-cox
bryan-cox force-pushed the worktree-hypershiftlinter-plugin branch from 183ea26 to 4017d79 Compare August 6, 2026 12:54
bryan-cox and others added 3 commits August 6, 2026 09:24
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bryan-cox
bryan-cox force-pushed the worktree-hypershiftlinter-plugin branch from 4017d79 to 14d5d00 Compare August 6, 2026 13:46
@bryan-cox
bryan-cox marked this pull request as ready for review August 6, 2026 16:31
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 6, 2026
@openshift-ci
openshift-ci Bot requested review from cblecker and clebs August 6, 2026 16:31
@openshift-ci

openshift-ci Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

@bryan-cox: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@devguyio

devguyio commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

/hold

Awesome! This is a great step

I put a hold though because I'd like to hold onto this PR until it gets more visibility and socialized with the contributors.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 6, 2026
@devguyio

devguyio commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

another way forward is to split this PR into two PRs, one that introduces the plugin and the rules without enabling it, the other that actually enables it, enforces it, and introduces the fixes.

@cblecker cblecker left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nodepool_controller_test.go lines 3681 and 3722 still use the pre-rename guard strings. Line 3681 compares "when reconciling it should set conditions in the expected order" but the test case at line 3533 was renamed to "When reconciling, it should set conditions in the expected order" (uppercase W, comma added). Same mismatch at line 3722 vs 3581. These guards never match, so ~60 lines of condition-ordering and early-exit assertions are silently skipped.

I see this was flagged in a review thread that was marked resolved, but the fix doesn't appear to have been applied to the current HEAD.

@@ -0,0 +1,337 @@
package vacuouspass

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 7 new analyzers have no unit tests. The Go analysis framework provides analysistest.Run() for exactly this -- each analyzer gets a _test.go with testdata/src/ fixtures and // want annotations. At ~1050 lines of analysis logic (especially vacuouspass at 337 lines with Ginkgo scope-walking), this needs test coverage. The PR checklist marks "This change includes unit tests" but the analyzers themselves aren't tested.

Run: run,
}

var namePattern = regexp.MustCompile(`(?i)^when .+ should .+$`)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regex accepts When X should Y which doesn't match TESTING.md's documented format When <condition>, it should <expected behavior> -- the word "it" and comma before "should" aren't required. Active violations exist in this PR: capi_test.go:1078 uses When taints are empty should return... which passes the linter but doesn't follow the convention.

Consider tightening to: (?i)^when .+,? it should .+$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/api Indicates the PR includes changes for the API area/ci-tooling Indicates the PR includes changes for CI or tooling area/cli Indicates the PR includes changes for CLI area/control-plane-operator Indicates the PR includes changes for the control plane operator - in an OCP release area/control-plane-pki-operator Indicates the PR includes changes for the control plane PKI operator - in an OCP release area/documentation Indicates the PR includes changes for documentation area/hypershift-operator Indicates the PR includes changes for the hypershift operator and API - outside an OCP release area/platform/aws PR/issue for AWS (AWSPlatform) platform area/platform/azure PR/issue for Azure (AzurePlatform) platform area/platform/gcp PR/issue for GCP (GCPPlatform) platform area/platform/kubevirt PR/issue for KubeVirt (KubevirtPlatform) platform area/platform/none PR/issue for None (NonePlatform) platform - user-supplied infrastructure area/platform/openstack PR/issue for OpenStack (OpenStackPlatform) platform area/platform/powervs PR/issue for PowerVS (PowerVSPlatform) platform area/testing Indicates the PR includes changes for e2e testing do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants