🤖 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.
Problem.
pkg/svc/provisioner/cluster/k3shetzner/provisioner.goandpkg/svc/provisioner/cluster/kubeadmhetzner/provisioner.gocarry near-identicalNewProvisionerconstructors (both delegate tohetznerbase.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.