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

Audit golangci-lint config #2058

Closed
10 tasks done
sbueringer opened this issue Jul 20, 2023 · 25 comments
Closed
10 tasks done

Audit golangci-lint config #2058

sbueringer opened this issue Jul 20, 2023 · 25 comments
Assignees
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

Comments

@sbueringer
Copy link
Member

sbueringer commented Jul 20, 2023

Let's compare the golangci-lint config with the one from core CAPI and see if we should add more linters / config etc. (also potentially in core CAPI).

Some observations:

  • I saw a few places where we didn't handle returned errors in CAPV. IIRC one of the linters enabled in core CAPI is catching that (not 100% sure). (we probably also need a corresponding exclude)
  • We should configure the importas linter for at least the most important imports to get some consistency

Tasks

@chrischdi
Copy link
Member

/assign

@chrischdi
Copy link
Member

chrischdi commented Aug 7, 2023

Let's tackle this in multiple steps:

  1. One PR which sync's the .golangci.yml file to the core CAPI version.

  2. Enable new Linters and enable configuration in multiple follow-up PRs. Doing this in a single PR would require too many code changes and would make it very hard for reviewers.

EDIT: moved this list to the top / initial comment as task list.

@lubronzhan
Copy link
Contributor

I was debugging my PR and found out that it doesn't print any lines and code for specific lint error.

Found out here it could be fixed by --out-format=colored-line-number

Verified here https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/actions/runs/5791075333/job/15695267905?pr=2171
Gonna add another PR for that

@sbueringer
Copy link
Member Author

@chrischdi Let's add a final step to diff against the core CAPI file again (just to make sure we didn't miss anything that we would want to have sync)

@chrischdi
Copy link
Member

Update the above list and the initial MR

@chrischdi
Copy link
Member

I already have a PR prepared as follow-up to enable the importas configuration.

@sbueringer
Copy link
Member Author

Feel free to move the sub-task list in the issue description itself in case you think it's better (fine either way for me)

@chrischdi
Copy link
Member

@zhanggbj @laozc : the first two MRs got merged 🎉

Feel free to pick up work from the leftover tasks above :-)

@zhanggbj
Copy link
Contributor

zhanggbj commented Aug 17, 2023

I'll start with this one :)

@sbueringer
Copy link
Member Author

/assign @zhanggbj

@sbueringer
Copy link
Member Author

We can assign multiple people, just pick a linter and let us know :)

/help

@k8s-ci-robot
Copy link
Contributor

@sbueringer:
This request has been marked as needing help from a contributor.

Guidelines

Please ensure that the issue body includes answers to the following questions:

  • Why are we solving this issue?
  • To address this issue, are there any code changes? If there are code changes, what needs to be done in the code and what places can the assignee treat as reference points?
  • Does this issue have zero to low barrier of entry?
  • How can the assignee reach out to you for help?

For more details on the requirements of such an issue, please see here and ensure that they are met.

If this request no longer meets these requirements, the label can be removed
by commenting with the /remove-help command.

In response to this:

We can assign multiple people, just pick a linter and let us know :)

/help

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Aug 18, 2023
@MrDXY
Copy link
Contributor

MrDXY commented Aug 21, 2023

I'll go with this one: 😊

  • dupword

@zhanggbj
Copy link
Contributor

/assign @MrDXY

@MrDXY
Copy link
Contributor

MrDXY commented Aug 23, 2023

Hi, folks, I created another pr to track the following task. #2273

  • enable linter errchkjson

@nunnatsa
Copy link
Contributor

Hi.

Just created a new PR to enable ginkgolinter; See #2282

@MrDXY
Copy link
Contributor

MrDXY commented Aug 29, 2023

Hi team, I will continue with nolintlint. 😄

@MrDXY
Copy link
Contributor

MrDXY commented Sep 4, 2023

Hi folks, I will proceed with enabling the configuration for gocritic. 😄

@adityabhatia
Copy link
Contributor

/assign

@adityabhatia
Copy link
Contributor

adityabhatia commented Sep 21, 2023

I will take this - remove apis/v1alpha3 from skip-files:

@chrischdi
Copy link
Member

chrischdi commented Sep 25, 2023

Took up some parts of

remove all additional exclusions below FIXME: All below excludes should get removed over time. (Multiple PRs

in:

@killianmuldoon
Copy link
Contributor

I'm going to have a go at adding comments across the code under FIXME

@killianmuldoon
Copy link
Contributor

I ran a diff between CAPV and CAPI golanglint-ci.yaml config files and there's nothing unexpected there. There's a tiny update to formatting in the CAPI file that will make diffing slightly easier - I'll raise that one in a PR.

Thanks everyone for your contributions!

@chrischdi I think we should close this if your happy with it - there's some follow-ups in #2384.

@killianmuldoon
Copy link
Contributor

/close

@k8s-ci-robot
Copy link
Contributor

@killianmuldoon: Closing this issue.

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

9 participants