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
KubeVirt coding guidelines or best practices #11259
Comments
/cc @alicefr |
/sig code-quality |
Example of if statement simplification by using return early pattern: #11260 |
I really like the |
/cc @aburdenthehand |
nice work, and adding to these ideas, I think that following the work done as part of kubevirt/community#219, it would also make sense to add some guidelines related to monitoring |
I'd like to add some line length limit! We might have wide screens in 2024 but a limit is needed :)
And, IMHO, 150 lines should be big enough already :) -- I would also suggest that, architecture related logic should be in their own code block. -- We should probably have a suggested indentation when a -- Last but not least, somewhat related to code guidelines is logging. We have this issue #8164 about log convention with a draft proposal #9398 Just my suggestions ;) |
One please here, if you see places in the code, where we could apply these best-practices already, please create an issue and use the label In this period, we can expect new contributors seeking for simple issues to solve as KubeVirt was accepted as part of GSoC this year. This kind of issues are a great start for people new to open source and kubevirt. |
@0xFelix Great to see this! How do we take this forward? How about starting with a rather minimal Let me note that Kube also has similar files, such as https://github.com/kubernetes/community/blob/master/contributors/guide/coding-conventions.md |
@fabiand Good idea, I will create a proposal PR for |
Got a proposal for |
Is your feature request related to a problem? Please describe:
KubeVirt could need a coding guideline or at least best practices for the codebase, to avoid code which is harder than necessary to understand and to maintain.
Some ideas (not ordered):
kubevirt.io/kubevirt/pkg/pointer
vsk8s.io/utils/ptr
)virtClient
vs callingkubevirt.Client()
when neededPatchSet
interface (introduced in refactor: use patch package instead of hardcoded operations #11211) instead offmt.Sprintf
to build patch setspath
package to construct paths instead of usingfmt.Sprintf
err
checks where possibleDescribeTables
as much as possiblek8sv1
orv1
, orvirtv1
orv1
)Ideally we could collect some more ideas and create a doc from that. Any input on that?
Describe the solution you'd like:
The outcome of this issue should be a doc containing KubeVirt coding guidelines.
Describe alternatives you've considered:
Do not provide guidelines and become desperate maintaining the code. :)
Additional context:
See work of sig/code-quality: https://github.com/kubevirt/kubevirt/pulls?q=is%3Apr+label%3Asig%2Fcode-quality+
The text was updated successfully, but these errors were encountered: