-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 json-c with clang-format tool #555
Conversation
Does changing the value used for IndentWidth have an effect? I suspect it doesn't but let's make it consistent with ContinuationIndentWidth (i.e. set it to 4) unless that screws something up. It's too bad we can't just tweak one of the BraceWrapping presets, but oh well. Let's turn off AllowShortIfStatementsOnASingleLine, it seems to make a lot of the codeflow look inconsistent and IMO somewhat harder to follow. There are a number of places where that shouldn't be reformatted, please add
|
ok, I will modify these optimazation options and block the partial content . But if the |
Oh, I see, it defaults to calculating tabs as 8 characters wide. If you set IndentWidth and TabWidth both to 4, then things end up mostly the same, though it wraps lines a bit less often because it calculates the location of the characters after the tab differently. ContinuationIndentWidth uses spaces, not tabs, to indent the continuation lines (even when indenting 8 characters or more), so let's leave that as ContinuationIndentWidth:4. |
I think the overall clang-formatting effect of this time is pretty good. You may not have the enough time to read the entire file. I add the following key points:
|
hi @hawicz, Are you satisfied with the above formatting results. I think the overall effect is acceptable and I can adjust the format at any time again. |
Yes, that all looks good. Looks like this needs to be updated one more time to address the recent conflicts that appeared, but once that's done let's go ahead and merge it. |
ok. The coveralls error should be related to setting of |
IndentWidth
andTabWidth
will overlay, so do not addTabWidth
.BreakBeforeBraces: Custom
. This is because we should not wrap the extern blocks. like:random_seed.c
is not suitable for clang-format. So exclude it from the range of this format temporarily.In a word, the codes of json-c have been well formatted. If we need to add or modify optimization options, we can format the codes on this basis.