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 Technical and style guide to the contribution guide #2250

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

tenzen-y
Copy link
Member

@tenzen-y tenzen-y commented Jan 3, 2024

What this PR does / why we need it:
I added the coding guide to the contribution guide.

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

Checklist:

  • Docs included if any changes are user facing

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tenzen-y

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

@tenzen-y
Copy link
Member Author

tenzen-y commented Jan 3, 2024

/assign @kubeflow/wg-automl-leads

Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

Thank you for adding this @tenzen-y! I added a few comments.
/assign @johnugeorge

## Technical and style guide

The following guidelines apply primarily to Katib,
but other projects like training-operator might also adhere to them.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
but other projects like training-operator might also adhere to them.
but other projects like [Training Operator](https://github.com/kubeflow/training-operator) might also adhere to them.

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


When coding:

- Follow [effective go](https://go.dev/doc/effective_go) guidelines.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we should add that developer should use gofmt to format their code.

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be better to focus on mentioning only items that it is difficult to automatically detect in CI.
WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it makes sense to say that developer can run ./hack/verify-gofmt.sh to format their Go codes. In that case, we can reduce number of changes that contributors need to do when they create PRs.

Like in K8s developer guides: https://github.com/kubernetes/community/blob/d48200bb58cfb877e4cd77043db1e9eb6d4c8e4e/contributors/devel/development.md#presubmission-verification

Copy link
Member Author

Choose a reason for hiding this comment

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

It makes sense.
As an alternative, I would suggest using make check. WDYT?

katib/Makefile

Line 31 in 4617346

check: generated-codes go-mod fmt vet lint

Copy link
Member

Choose a reason for hiding this comment

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

Sure, that even better, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


Testing:

- Use `cmp.Diff` instead of `reflect.Equal`, to provide useful comparisons.
Copy link
Member

Choose a reason for hiding this comment

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

Would be nice to provide link to cmp.Diff.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Testing:

- Use `cmp.Diff` instead of `reflect.Equal`, to provide useful comparisons.
- Define test cases as maps instead of slices to avoid dependencies on te running order.
Copy link
Member

@andreyvelich andreyvelich Jan 3, 2024

Choose a reason for hiding this comment

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

Maybe we should say that:

Suggested change
- Define test cases as maps instead of slices to avoid dependencies on te running order.
- Define test cases as maps instead of slices to avoid dependencies on the running order. Map key should be equal to the test case name.

Copy link
Member Author

Choose a reason for hiding this comment

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

That’s a great clarification!

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.


The following guidelines apply primarily to Katib,
but other projects like training-operator might also adhere to them.

Copy link
Member

Choose a reason for hiding this comment

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

Should we make a section about Golang here since Katib has various components written in Go, Python, Typescript?

Suggested change
## Golang Development

Copy link
Member Author

Choose a reason for hiding this comment

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

SGTM

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@andreyvelich andreyvelich changed the title Add Technical and style guide to the contribution gude Add Technical and style guide to the contribution guide Jan 3, 2024
@tenzen-y
Copy link
Member Author

tenzen-y commented Jan 3, 2024

@andreyvelich I addressed all your comments. PTAL

@tenzen-y
Copy link
Member Author

tenzen-y commented Jan 3, 2024

I will create a separate PR to fix the Python lint error.

@tenzen-y
Copy link
Member Author

tenzen-y commented Jan 3, 2024

I will create a separate PR to fix the Python lint error.

I opened a PR: #2251

@tenzen-y
Copy link
Member Author

tenzen-y commented Jan 4, 2024

Rebased

Copy link
Member

@andreyvelich andreyvelich left a comment

Choose a reason for hiding this comment

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

Thanks @tenzen-y!
/lgtm

@google-oss-prow google-oss-prow bot added the lgtm label Jan 4, 2024
@google-oss-prow google-oss-prow bot merged commit bf9a1b0 into kubeflow:master Jan 4, 2024
59 checks passed
@tenzen-y tenzen-y deleted the add-coding-guide branch January 4, 2024 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants