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
Format codes with clang-format tool? #550
Comments
Several things:
|
This change is really not comfortable indeed. Many files will be formatted. But the advantage is that the code will be cleaner and developers can read/update code easily. At the same time, contributors could optimize the code in a uniform format. I will add the optimization options according to your requirements. |
Never mind about rewriting all commit history. I just tried doing that, and it ends up being more of a mess that it's worth. git blame has a -w option anyway, which will mostly ignore formatting changes. |
hi, hawicz @hawicz
The code formof json-c is a little messy, like
json_tokener.c
. Spaces and tabs are used mixedly and the code style is not unified. Maybe code formatting is a good choice. I submitted the.clang-format
( clang-format configuration file ) and a formatted demo in https://github.com/dota17/json-c/pull/58/files.If you are insterested in it. I am willing to submit the
.clang-format
file. And we could also add some other optimization options or formats you want. The other options are introduced in clang.llvm.org.We can format the code by
clang-format -i xxxx.c -style=file
. And if a contributor want to add some codes, he can format the modified file by using.clang-format
simply. Even, we can added formatting-code script in CI as entrance guard to force contributor formatting the codes, like jsoncpp.The text was updated successfully, but these errors were encountered: