Skip to content

Dedupe the near-identical k3shetzner/kubeadmhetzner NewProvisioner constructors (jscpd rounding-edge) #5748

Description

@devantler

🤖 Generated by the Daily AI Assistant

Problem. pkg/svc/provisioner/cluster/k3shetzner/provisioner.go and pkg/svc/provisioner/cluster/kubeadmhetzner/provisioner.go carry near-identical NewProvisioner constructors (both delegate to hetznerbase.NewBase, differing only in the version field they store). jscpd (mega-linter COPYPASTE, threshold 0) detects this as a 6-line/80-token clone that currently sits at the rounding edge: alone it reports 0.00% and passes, but ANY additional small clone anywhere in the codebase tips the total to 0.01% and reds mega-linter on an otherwise-unrelated PR (observed live on #5746, where a second clone made this pre-existing one count).

Proposal. Either dedupe (a tiny shared constructor helper in hetznerbase, e.g. parameterized on the stored version field/transport) or, if a helper obscures more than it saves, restructure one constructor enough to fall out of clone detection. Dedupe is preferred — behaviour-preserving, tests unchanged.

Acceptance criteria.

  • jscpd reports no clone between the two provisioner constructors
  • mega-linter green with no threshold/config change
  • existing k3shetzner/kubeadmhetzner tests unchanged and green

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions