CNTRLPLANE-4008: feat: add hypershiftlinter golangci-lint plugin - #9237
CNTRLPLANE-4008: feat: add hypershiftlinter golangci-lint plugin#9237bryan-cox wants to merge 3 commits into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
Skipping CI for Draft Pull Request. |
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR adds the 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
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
|
4d80587 to
d2da990
Compare
d2da990 to
a2056a8
Compare
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
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. |
There was a problem hiding this comment.
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
📒 Files selected for processing (111)
.golangci.ymlMakefilecmd/cluster/agent/create_test.gocmd/cluster/aws/create_test.gocmd/cluster/aws/destroy_test.gocmd/cluster/azure/create_test.gocmd/cluster/core/create_test.gocmd/cluster/core/dump_test.gocmd/cluster/gcp/create_test.gocmd/cluster/kubevirt/create_test.gocmd/cluster/none/create_test.gocmd/cluster/openstack/create_test.gocmd/cluster/powervs/create_test.gocmd/nodepool/aws/create_test.gocmd/nodepool/azure/create_test.gocmd/nodepool/kubevirt/create_test.gocmd/nodepool/openstack/create_test.gocmd/oadp/backup_test.gocmd/oadp/common_test.gocmd/oadp/restore_test.gocmd/oadp/schedule_test.gocmd/util/azure_test.gocmd/util/params_test.gocontrol-plane-operator/controllers/awsprivatelink/awsprivatelink_controller_test.gocontrol-plane-operator/controllers/azureprivatelinkservice/observer_test.gocontrol-plane-operator/controllers/gcpprivateserviceconnect/observer_test.gocontrol-plane-operator/controllers/hostedcontrolplane/creatorupdate_ownerref_enforcer_test.gocontrol-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller_test.gocontrol-plane-operator/controllers/hostedcontrolplane/infra/infra_test.gocontrol-plane-operator/controllers/hostedcontrolplane/pki/kas_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/autoscaler/component_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/etcd/etcd_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/karpenter/component_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/kas/config_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/kas/params_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/globalps/globalps_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/globalps/setup_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/inplaceupgrader/inplaceupgrader_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/resources/ingress/params_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.gocontrol-plane-pki-operator/certificaterevocationcontroller/certificaterevocationcontroller_test.gocontrol-plane-pki-operator/certificatesigningcontroller/certificatesigningcontroller_test.gohack/tools/go.modhack/tools/hypershiftlinter/analyzers/contextbackground/contextbackground.gohack/tools/hypershiftlinter/analyzers/guestcluster/guestcluster.gohack/tools/hypershiftlinter/analyzers/ipv6url/ipv6url.gohack/tools/hypershiftlinter/analyzers/pathutil/pathutil.gohack/tools/hypershiftlinter/analyzers/sippyannotation/sippyannotation.gohack/tools/hypershiftlinter/analyzers/testcasename/testcasename.gohack/tools/hypershiftlinter/analyzers/testfuncname/testfuncname.gohack/tools/hypershiftlinter/analyzers/vacuouspass/vacuouspass.gohack/tools/hypershiftlinter/cmd/plugin/main.gohack/tools/hypershiftlinter/plugin.gohypershift-operator/controllers/hostedcluster/createorupdate_annotation_enforcer_test.gohypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.gohypershift-operator/controllers/hostedcluster/hostedcluster_webhook_test.gohypershift-operator/controllers/hostedcluster/internal/platform/aws/aws_test.gohypershift-operator/controllers/hostedcluster/internal/platform/azure/azure_test.gohypershift-operator/controllers/hostedcluster/internal/platform/openstack/openstack_test.gohypershift-operator/controllers/hostedcluster/karpenter_test.gohypershift-operator/controllers/hostedcluster/metrics/metrics_test.gohypershift-operator/controllers/hostedcluster/security_context_uid_test.gohypershift-operator/controllers/hostedcluster/validations/ocpapiserver_test.gohypershift-operator/controllers/hostedclustersizing/hostedclustersizing_controller_test.gohypershift-operator/controllers/nodepool/aws_test.gohypershift-operator/controllers/nodepool/capi_test.gohypershift-operator/controllers/nodepool/config_test.gohypershift-operator/controllers/nodepool/instancetype/aws/provider_test.gohypershift-operator/controllers/nodepool/kubevirt/kubevirt_test.gohypershift-operator/controllers/nodepool/nodepool_controller_test.gohypershift-operator/controllers/nodepool/nto_test.gohypershift-operator/controllers/nodepool/openstack/openstack_test.gohypershift-operator/controllers/nodepool/secret_janitor_test.gohypershift-operator/controllers/platform/aws/controller_test.gohypershift-operator/controllers/platform/gcp/privateserviceconnect_controller_test.gohypershift-operator/controllers/scheduler/aws/autoscaler_test.gohypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.gohypershift-operator/controllers/scheduler/aws/placeholders_test.gohypershift-operator/controllers/scheduler/azure/controllers_test.gohypershift-operator/controllers/scheduler/util/scheduler_test.gohypershift-operator/controllers/sharedingress/router_test.gohypershift-operator/controllers/uwmtelemetry/uwm_telemetry_test.gohypershift-operator/featuregate/feature_test.goignition-server/controllers/tokensecret_controller_test.gokas-bootstrap/kas_boostrap_test.gopkg/etcdcli/health_test.gopkg/featuregates/featuregates_test.gosupport/azureutil/azureutil_test.gosupport/backwardcompat/backwardcompat_test.gosupport/catalogs/images_test.gosupport/config/resources_test.gosupport/etcd/shards_test.gosupport/events/message_test.gosupport/forwarder/forwarder_test.gosupport/karpenter/karpenter_test.gosupport/konnectivityproxy/dialer_test.gosupport/netutil/iputil_test.gosupport/netutil/networking_test.gosupport/netutil/public_test.gosupport/oadp/validate_test.gosupport/openstackutil/conversion_test.gosupport/podspec/containers_test.gosupport/proxy/proxy_test.gosupport/releaseinfo/registryclient/client_test.gosupport/secretproviderclass/secretproviderclass_test.gosupport/supportedversion/version_test.gosupport/util/cleanup_tracker_test.gosupport/util/maps_test.gosupport/util/registryoverride/registryoverride_test.gosupport/util/util_test.gosync-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
5936c0d to
c20ed6d
Compare
|
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. |
c20ed6d to
502271b
Compare
|
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. |
502271b to
bbcbec4
Compare
There was a problem hiding this comment.
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
⛔ Files ignored due to path filters (47)
cmd/cluster/agent/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yamlis excluded by!**/testdata/**cmd/cluster/aws/testdata/zz_fixture_TestCreateCluster_When_KubeAPIServerDNSName_is_provided__it_should_configure_custom_DNS_name.yamlis excluded by!**/testdata/**cmd/cluster/aws/testdata/zz_fixture_TestCreateCluster_When_OVNKubernetesMTU_is_provided__it_should_configure_custom_MTU.yamlis excluded by!**/testdata/**cmd/cluster/aws/testdata/zz_fixture_TestCreateCluster_When_default_creation_flags_are_provided__it_should_create_cluster_with_expected_configuration.yamlis excluded by!**/testdata/**cmd/cluster/aws/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_Azure_Marketplace_image_flags_are_provided__it_should_configure_marketplace_image.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_KubeAPIServerDNSName_is_provided__it_should_configure_custom_DNS_name.yamlis 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.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_availability_zones_are_provided__it_should_configure_zones.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_complex_configuration_flags_are_provided__it_should_create_cluster_with_all_options.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_disabled_capabilities_are_provided__it_should_configure_disabled_capabilities.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_endpoint_access_is_Private_with_private_flags__it_should_configure_private_endpoint_access.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_image_generation_Gen1_is_provided__it_should_configure_Gen1_images.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_image_generation_Gen2_is_provided__it_should_configure_Gen2_images.yamlis 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.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_When_oauth_publishing_strategy_is_LoadBalancer__it_should_configure_OAuth_LoadBalancer.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_create_with_a_ure_marketplace_image.yamlis excluded by!**/testdata/**cmd/cluster/azure/testdata/zz_fixture_TestCreateCluster_with_availability_ones.yamlis excluded by!**/testdata/**cmd/cluster/gcp/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yamlis excluded by!**/testdata/**cmd/cluster/kubevirt/testdata/zz_fixture_TestCreateCluster_When_complex_configuration_flags_are_provided__it_should_create_cluster_with_all_options.yamlis excluded by!**/testdata/**cmd/cluster/kubevirt/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yamlis excluded by!**/testdata/**cmd/cluster/none/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided__it_should_render_successfully.yamlis excluded by!**/testdata/**cmd/cluster/openstack/testdata/zz_fixture_TestCreateCluster_When_default_creation_flags_are_provided_it_should_render_successfully.yamlis excluded by!**/testdata/**cmd/cluster/openstack/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided_it_should_render_successfully.yamlis excluded by!**/testdata/**cmd/cluster/powervs/testdata/zz_fixture_TestCreateCluster_When_minimal_flags_are_provided_it_should_render_successfully.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis 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.yamlis excluded by!**/testdata/**control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_AWS_private_cluster_uses_Route__it_should_configure_internal_router.yamlis 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.yamlis 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.yamlis 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.yamlis excluded by!**/testdata/**control-plane-operator/controllers/hostedcontrolplane/infra/testdata/zz_fixture_TestReconcileInfrastructure_When_AWS_public_cluster_uses_Route__it_should_configure_external_router.yamlis 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.yamlis 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.yamlis excluded by!**/testdata/**
📒 Files selected for processing (112)
.github/workflows/lint-reusable.yaml.golangci.ymlMakefilecmd/cluster/agent/create_test.gocmd/cluster/aws/create_test.gocmd/cluster/aws/destroy_test.gocmd/cluster/azure/create_test.gocmd/cluster/core/create_test.gocmd/cluster/core/dump_test.gocmd/cluster/gcp/create_test.gocmd/cluster/kubevirt/create_test.gocmd/cluster/none/create_test.gocmd/cluster/openstack/create_test.gocmd/cluster/powervs/create_test.gocmd/nodepool/aws/create_test.gocmd/nodepool/azure/create_test.gocmd/nodepool/kubevirt/create_test.gocmd/nodepool/openstack/create_test.gocmd/oadp/backup_test.gocmd/oadp/common_test.gocmd/oadp/restore_test.gocmd/oadp/schedule_test.gocmd/util/azure_test.gocmd/util/params_test.gocontrol-plane-operator/controllers/awsprivatelink/awsprivatelink_controller_test.gocontrol-plane-operator/controllers/azureprivatelinkservice/observer_test.gocontrol-plane-operator/controllers/gcpprivateserviceconnect/observer_test.gocontrol-plane-operator/controllers/hostedcontrolplane/creatorupdate_ownerref_enforcer_test.gocontrol-plane-operator/controllers/hostedcontrolplane/hostedcontrolplane_controller_test.gocontrol-plane-operator/controllers/hostedcontrolplane/infra/infra_test.gocontrol-plane-operator/controllers/hostedcontrolplane/pki/kas_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/autoscaler/component_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/etcd/etcd_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/karpenter/component_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/kas/config_test.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/kas/params_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/globalps/globalps_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/globalps/setup_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/inplaceupgrader/inplaceupgrader_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/resources/ingress/params_test.gocontrol-plane-operator/hostedclusterconfigoperator/controllers/resources/resources_test.gocontrol-plane-pki-operator/certificaterevocationcontroller/certificaterevocationcontroller_test.gocontrol-plane-pki-operator/certificatesigningcontroller/certificatesigningcontroller_test.gohack/tools/go.modhack/tools/hypershiftlinter/analyzers/contextbackground/contextbackground.gohack/tools/hypershiftlinter/analyzers/guestcluster/guestcluster.gohack/tools/hypershiftlinter/analyzers/ipv6url/ipv6url.gohack/tools/hypershiftlinter/analyzers/pathutil/pathutil.gohack/tools/hypershiftlinter/analyzers/sippyannotation/sippyannotation.gohack/tools/hypershiftlinter/analyzers/testcasename/testcasename.gohack/tools/hypershiftlinter/analyzers/testfuncname/testfuncname.gohack/tools/hypershiftlinter/analyzers/vacuouspass/vacuouspass.gohack/tools/hypershiftlinter/cmd/plugin/main.gohack/tools/hypershiftlinter/plugin.gohypershift-operator/controllers/hostedcluster/createorupdate_annotation_enforcer_test.gohypershift-operator/controllers/hostedcluster/hostedcluster_controller_test.gohypershift-operator/controllers/hostedcluster/hostedcluster_webhook_test.gohypershift-operator/controllers/hostedcluster/internal/platform/aws/aws_test.gohypershift-operator/controllers/hostedcluster/internal/platform/azure/azure_test.gohypershift-operator/controllers/hostedcluster/internal/platform/openstack/openstack_test.gohypershift-operator/controllers/hostedcluster/karpenter_test.gohypershift-operator/controllers/hostedcluster/metrics/metrics_test.gohypershift-operator/controllers/hostedcluster/security_context_uid_test.gohypershift-operator/controllers/hostedcluster/validations/ocpapiserver_test.gohypershift-operator/controllers/hostedclustersizing/hostedclustersizing_controller_test.gohypershift-operator/controllers/nodepool/aws_test.gohypershift-operator/controllers/nodepool/capi_test.gohypershift-operator/controllers/nodepool/config_test.gohypershift-operator/controllers/nodepool/instancetype/aws/provider_test.gohypershift-operator/controllers/nodepool/kubevirt/kubevirt_test.gohypershift-operator/controllers/nodepool/nodepool_controller_test.gohypershift-operator/controllers/nodepool/nto_test.gohypershift-operator/controllers/nodepool/openstack/openstack_test.gohypershift-operator/controllers/nodepool/secret_janitor_test.gohypershift-operator/controllers/platform/aws/controller_test.gohypershift-operator/controllers/platform/gcp/privateserviceconnect_controller_test.gohypershift-operator/controllers/scheduler/aws/autoscaler_test.gohypershift-operator/controllers/scheduler/aws/dedicated_request_serving_nodes_test.gohypershift-operator/controllers/scheduler/aws/placeholders_test.gohypershift-operator/controllers/scheduler/azure/controllers_test.gohypershift-operator/controllers/scheduler/util/scheduler_test.gohypershift-operator/controllers/sharedingress/router_test.gohypershift-operator/controllers/uwmtelemetry/uwm_telemetry_test.gohypershift-operator/featuregate/feature_test.goignition-server/controllers/tokensecret_controller_test.gokas-bootstrap/kas_boostrap_test.gopkg/etcdcli/health_test.gopkg/featuregates/featuregates_test.gosupport/azureutil/azureutil_test.gosupport/backwardcompat/backwardcompat_test.gosupport/catalogs/images_test.gosupport/config/resources_test.gosupport/etcd/shards_test.gosupport/events/message_test.gosupport/forwarder/forwarder_test.gosupport/karpenter/karpenter_test.gosupport/konnectivityproxy/dialer_test.gosupport/netutil/iputil_test.gosupport/netutil/networking_test.gosupport/netutil/public_test.gosupport/oadp/validate_test.gosupport/openstackutil/conversion_test.gosupport/podspec/containers_test.gosupport/proxy/proxy_test.gosupport/releaseinfo/registryclient/client_test.gosupport/secretproviderclass/secretproviderclass_test.gosupport/supportedversion/version_test.gosupport/util/cleanup_tracker_test.gosupport/util/maps_test.gosupport/util/registryoverride/registryoverride_test.gosupport/util/util_test.gosync-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
2aae996 to
183ea26
Compare
|
@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. DetailsIn response to this:
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. |
183ea26 to
4017d79
Compare
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>
4017d79 to
14d5d00
Compare
|
@bryan-cox: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/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. |
|
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
left a comment
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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 .+$`) |
There was a problem hiding this comment.
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 .+$
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:
testcasename,testfuncnameguestcluster,contextbackground,vacuouspass,ipv6url,sippyannotationEnabled by default in
.golangci.yml, runs as part ofmake lint. Makefile tracks plugin source files so the.sois rebuilt when analyzer code changes.GHA lint workflow updated to cache
hack/tools/bin/(keyed onMakefile + 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, plusTest_toTestCamelCaserenames.Commit 3 — Temporary (squash before merge):
Points
lint.yamlcaller at this branch'slint-reusable.yamlso the workflow changes can be tested in CI before merge. Must be reverted to@mainbefore merging.Which issue(s) this PR fixes:
Fixes CNTRLPLANE-4008
Special notes for your reviewer:
.so) usingCGO_ENABLED=1 -buildmode=pluginhack/tools/go.mod— the pre-built tools on the runner image have a differentgolang.org/x/toolsversion, causingplugin.Open()to fail. The workflow change from pre-built copy to source build + cache fixes this.test/e2e/v2/filesmake lintpasses clean with 0 hypershiftlinter violationsChecklist: