kubernetes-sigs / kubernetes-sigs/cluster-api

Lint unused funcs

Open
#7,599 12 comments 0 reactions 1 assignee Claimed by @shamshad-ansari View on GitHub
help wanted kind/feature priority/backlog triage/accepted
Dominant language
Go
Stars
4.3k
Forks
1.6k
Avg merge
1d 3h
Merged PRs (30d)
113

Description

It would be great if we had a linter which detects unused funcs.

I recently opened a PR to drop some unused code in KCP: https://github.com/kubernetes-sigs/cluster-api/pull/7598

I found the following cases:
1. funcs which weren't used by anyone: e.g. ControlPlane.MachineInfrastructureTemplateRef
2. funcs which were only used by test code: e.g. ControlPlane.NewMachine

I think if there is a linter 1. should be relatively easy to detect.

I'm not sure about 2., it could be that there are a lot of false positives as we probably have non-test code which is used as test utils in tests.

But even if we only find a linter for 1. it should be a good improvement

/kind feature

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.