Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Introduce additional linters & bump golangci-lint to 1.50.1 #7581

Merged
merged 1 commit into from
Nov 22, 2022

Conversation

Prajyot-Parab
Copy link
Contributor

Signed-off-by: Prajyot-Parab prajyot.parab2@ibm.com

What this PR does / why we need it:

  • Introduce additional linters & bump golangci-lint to 1.50.1

Here are the descriptions of the new linters this PR proposes to add:

  • decorder: check declaration order and count of types, constants, variables and functions [fast: true, auto-fix: false]
  • execinquery: execinquery is a linter about query string checker in Query function which reads your Go src files and warning it finds [fast: false, auto-fix: false]
  • nosprintfhostport: Checks for misuse of Sprintf to construct a host with port in a URL. [fast: true, auto-fix: false]
  • reassign: Checks that package variables are not reassigned [fast: false, auto-fix: false]
  • usestdlibvars: A linter that detect the possibility to use variables/constants from the Go standard library. [fast: true, auto-fix: false]

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 22, 2022
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Nov 22, 2022
Copy link
Member

@fabriziopandini fabriziopandini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from my side
@oscr @sbueringer who did recent work in this area

.golangci.yml Outdated Show resolved Hide resolved
.golangci.yml Outdated Show resolved Hide resolved
.golangci.yml Outdated Show resolved Hide resolved
.golangci.yml Outdated Show resolved Hide resolved
@killianmuldoon
Copy link
Contributor

Thanks for the contribution @Prajyot-Parab 😃

IMO it would be better not to include execinquery and decorder in this PR, but it would be great to see a discussion in a new PR about how to implement the rules in decorder in CAPI.

It would be awesome if you could enable a pattern in the settings for reassign and fix the findings in this PR though!

@oscr
Copy link
Contributor

oscr commented Nov 22, 2022

I agree with @killianmuldoon summary.

@Prajyot-Parab Thank you for your help. There are some good checks here that we are missing.

Signed-off-by: Prajyot-Parab <prajyot.parab2@ibm.com>
@oscr
Copy link
Contributor

oscr commented Nov 22, 2022

Thank you for helping us explore the vast area of linters!

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 22, 2022
Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes!

/lgtm

@sbueringer
Copy link
Member

Thx @Prajyot-Parab

Can you please update the PR description to reflect the linters that were eventually added via this PR?

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 22, 2022
@k8s-ci-robot k8s-ci-robot merged commit 844eff2 into kubernetes-sigs:main Nov 22, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.4 milestone Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants