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

Add max limit of 2 groups to import blocks #566

Merged
merged 2 commits into from
Dec 9, 2021

Conversation

mmlb
Copy link
Contributor

@mmlb mmlb commented Dec 6, 2021

Description

Updates CONTRIBUTING.md with a Go style item.
Also enforces the new style via code in ./ci-checks.sh

Why is this needed

Consistency within the code base.

How Has This Been Tested?

Ran locally.

How are existing users impacted? What migration steps/scripts do we need?

NA

Checklist:

I have:

  • updated the documentation and/or roadmap (if required)

@mmlb mmlb requested a review from micahhausler December 6, 2021 16:33
@codecov
Copy link

codecov bot commented Dec 6, 2021

Codecov Report

Merging #566 (2e2b6bc) into main (b89f887) will not change coverage.
The diff coverage is n/a.

❗ Current head 2e2b6bc differs from pull request most recent head d05bf69. Consider uploading reports for the commit d05bf69 to get more accurate results
Impacted file tree graph

@@           Coverage Diff           @@
##             main     #566   +/-   ##
=======================================
  Coverage   34.76%   34.76%           
=======================================
  Files          44       44           
  Lines        3348     3348           
=======================================
  Hits         1164     1164           
  Misses       2085     2085           
  Partials       99       99           
Impacted Files Coverage Δ
cmd/tink-cli/cmd/get/get.go 70.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b89f887...d05bf69. Read the comment docs.

@mmlb mmlb force-pushed the enforce-max-num-import-groups branch from 1bbd307 to 94073ce Compare December 6, 2021 16:45
micahhausler
micahhausler previously approved these changes Dec 6, 2021
Copy link
Contributor

@micahhausler micahhausler left a comment

Choose a reason for hiding this comment

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

LGTM

mmlb added 2 commits December 9, 2021 15:17
There isn't a whole lot of direction from the go project or tools for this.
A quick google search did turn up 2 projects that also document 2 groups, both
[Uber] and [CockroachDB].
We do have both goimports and gofumpt splitting stdlib vs others out if they
are mixed. But they don't do any futher kind of grouping. So in the absence of
concrete handling lets just settle on 2 because its easy to enforce. The script
below deletes newlines within `import ( ... )` blocks and then runs gofumpt which
will split and sort 2 at most 2 groups.

[Uber]: https://github.com/uber-go/guide/blob/22f61e283ac2f75ba34b62f565581cc70e35fb7a/style.md#import-group-ordering
[CockroachDB]: https://web.archive.org/web/20210509102622/https://wiki.crdb.io/wiki/spaces/CRDB/pages/181371303/Go+Golang+coding+guidelines#Import-Group-Ordering

Signed-off-by: Manuel Mendez <[email protected]>
Copy link
Contributor

@micahhausler micahhausler left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@nshalman nshalman left a comment

Choose a reason for hiding this comment

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

Looks fine to me. Do we want to centralize this into the lint-install linters?

@mmlb
Copy link
Contributor Author

mmlb commented Dec 9, 2021

Looks fine to me. Do we want to centralize this into the lint-install linters?

Good question @nshalman ! Just this PR or the whole file? (I think latter tbh).

@mmlb mmlb added the ready-to-merge Signal to Mergify to merge the PR. label Dec 9, 2021
@mergify mergify bot merged commit b18b238 into tinkerbell:main Dec 9, 2021
@mmlb mmlb deleted the enforce-max-num-import-groups branch December 9, 2021 20:44
@displague displague added this to the 0.7.0 milestone Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready-to-merge Signal to Mergify to merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants