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

WIP: 🌱 Enable gci linter #4633

Closed
wants to merge 1 commit into from

Conversation

stmcginnis
Copy link
Contributor

What this PR does / why we need it:

This adds the gci linter to make sure imports are properly formatted and
grouped. This will remove the need for code reviewers to nitpick PRs by
making it an objective result reported from a test.

Which issue(s) this PR fixes:
Related #4622

Hitting some failures when running make test that I need to investigate yet.
Getting errors like:

2021/05/18 17:17:16 http: TLS handshake error from 127.0.0.1:51246: EOF

Followed by failures from 500 results and other mismatches.

This adds the gci linter to make sure imports are properly formatted and
grouped.

Signed-off-by: Sean McGinnis <[email protected]>
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 18, 2021
@k8s-ci-robot
Copy link
Contributor

Hi @stmcginnis. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 18, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign justinsb after the PR has been reviewed.
You can assign the PR to them by writing /assign @justinsb in a comment when ready.

The full list of commands accepted by this bot can be found 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

@sbueringer
Copy link
Member

sbueringer commented May 19, 2021

@stmcginnis I think we only wanted to add: exportloopref, ifshort, nilerr (#4624 (comment))

Although I personally really like that one and the grouping with local imports :)

@stmcginnis
Copy link
Contributor Author

Thanks Stefan. I'll close this and maybe we can decide if we want to reopen it later. I do think it adds some nice checks that could help avoid nitpicking in commits.

At least it uncovered that we have a bunch of importing errors. There are a surprising number of cases where we import the same package multiple times in a file under different aliases. In some cases this looks like maybe just mistakes as different people have worked on the same file, but in others they were very legitimate errors where we were originally using two different packages but accidentally updated to use the same one. (#4632)

@stmcginnis stmcginnis closed this May 19, 2021
@sbueringer
Copy link
Member

@stmcginnis Nice! I add a proposal about importas linter to the issue, it addresses a related issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants