Closed ityuhui closed 4 years ago
/cc @brendandburns
Thanks for the examples!
I think we need to adopt a style guide for this repo, and add some validation testing to ensure that code matches the style guide.
Do you have any suggestions for a good C style guide? Perhaps Gnu Indent (https://www.gnu.org/software/indent/)
@brendandburns Thank you for your review. I will update the code by your comment.
And I agree that we should adopt a style guide for this repo. Let me learn and try Gnu Indent.
Hi @brendandburns
Do you have a preferred GNU Indent parameter list ? (e.g. -npro -nip -nlp -npsl -i4 -ts4 -sob -l200 -ss -bl -bli 0)
If not, I will prepare a parameter list for your review.
I don't have a preferred parameter list, let's start with what you suggest.
Sounds great, let me know when this PR is ready to review again.
Thanks!
Hi @brendandburns
I have prepared a parameter list of GNU Indent for your review:
-npro -nbad -nip -lp -npsl -npcs -i4 -ts4 -sob -br -ce -nut -bap -nbc -bbo -brs -cs -nfc1 -nfca -hnl -ip0 -nprs -saf -sai -saw -ci4 -cli0 -l200
Option | Description |
---|---|
-npro | Do not read ‘.indent.pro’ files. |
-nbad | Do not force blank lines after declarations. |
-nip | Zero width indentation for parameters. |
-lp | Line up continued lines at parentheses. |
-npsl | Put the type of a procedure on the same line as its name. |
-npcs | Do not put space after the function in function calls. |
-i4 | Set indentation level to 4 spaces. |
-ts4 | Set tab size to 4 spaces. |
-sob | Swallow optional blank lines. |
-br | Put braces on line with if, etc. |
-ce | Cuddle else and preceding ‘}’. |
-nut | Use spaces instead of tabs. |
-bap | Force blank lines after procedure bodies. |
-nbc | Do not force newlines after commas in declarations. |
-bbo | Prefer to break long lines before boolean operators. |
-brs | Put braces on struct declaration line. |
-cs | Put a space after a cast operator. |
-nfc1 | Do not format comments in the first column as normal. |
-nfca | Do not format any comments. |
-hnl | Prefer to break long lines at the position of newlines in the input. |
-ip0 | Indent parameter types in old-style function definitions by 0 spaces. |
-nprs | Do not put a space after every '(' and before every ')'. |
-saf | Put a space after each for. |
-sai | Put a space after each if. |
-saw | Put a space after each while. |
-ci4 | Continuation indent of 4 spaces. |
-cli0 | Case label indent of 0 spaces. |
-l200 | Set maximum line length for non-comment lines to 200. |
I have used GNU Indent with this parameter list to generate the new example source code and pushed them here for review again.
Looks great!
/lgtm /approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: brendandburns, ityuhui
The full list of commands accepted by this bot can be found here.
The pull request process is described here
Add two examples to demo how to use the c client library:
Because now kuberentes-client/c has no utility such as "config" functions in addition to the source code generated by OpenAPI c generator, these two examples implement the config utility functions in their own source code.
After this PR, I will implement and integrate the config utility to kuberentes-client/c. the same as other language client libraries.