ClangFormat the C code by hugovk · Pull Request #4770 · python-pillow/Pillow
Fixes #4493.
I found a "clang-format style that approximates Python's PEP 7":
(The zoneinfo repo was the reference implementation for zoneinfo in the stdlib (PEP 615), and is now a backport for Python 3.6+.)
This style has also been used elsewhere, as is or as the basis:
Including CPython's new PEG generator (written by Guido and two others), which is the same as the zoneinfo one but with ColumnLimit increased from 79 to 95:
Here's how it looks applied to Pillow:
clang-format -i `git ls-tree -r HEAD --name-only | grep "\.[ch]$"`- The first commit is the same config file as in zoneinfo
- The second formats the codebase with the config
- The third increases
ColumnLimitfrom 79 to 88, to match Black - The fourth formats again with the 88 limit
I suggest we use this, and welcome feedback and any further tweaks.
Before merge, to make the history cleaner, I'll squash the config to a single commit, and the formatting to another single commit.
Also this will need adding to the CI.