kubernetes-retired / cluster-api-provider-nested

Cluster API Provider for Nested Clusters
Apache License 2.0
301 stars 67 forks source link

✨ Enable all golangci-lint plugins for virtual cluster project #287

Closed m-messiah closed 2 years ago

m-messiah commented 2 years ago

What this PR does / why we need it:

This is the last part from three-step golangci-lint enable, started in https://github.com/kubernetes-sigs/cluster-api-provider-nested/pull/285 and https://github.com/kubernetes-sigs/cluster-api-provider-nested/pull/286.

This part is focused on the gosimple, gosec, gocyclo and revive checkers, bringing little more readability and memory usage efficiency.

Notes

  1. The revive plugin has two exclusions, because otherwise it would require to write too much comments, which could not make a lot of sense:
# EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments
- exported (.+) should have comment( \(or a comment on this block\))? or be unexported
# EXC0013 revive: Annoying issue about not having a comment. The rare codebase has such comments
- package comment should be of the form "(.+)...

Notable changes

  1. kubectl-vc kubeconfig creation mode changed to 0600 instead of 0644. There is no sense to make config readable for other users, but if you have any objections - I could revert it and disable in gosec linter.
  2. Minimum TLS version for TLSConfig is pinned to TLS1.2. I can't imaging anybody to use older and less secure, but it is still one of major changes
  3. provisioner.ProvisionerAliyun is renamed to provisioner.Aliyun due to unnecessary duplication of the word provisioner
  4. provisioner.ProvisionerNative is renamed to provisioner.Native due to unnecessary duplication of the word provisioner
  5. validationplugin.ValidationPluginInterface is renamed to validationplugin.Interface due to unnecessary duplication of the word validationplugin
  6. fairqueue.FifoQueue is exported type now
k8s-ci-robot commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christopherhein, m-messiah

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

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[virtualcluster/OWNERS](https://github.com/kubernetes-sigs/cluster-api-provider-nested/blob/main/virtualcluster/OWNERS)~~ [christopherhein] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment