I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
Name |
Last commit
|
Last update |
---|---|---|
.github | Loading commit data... | |
core | Loading commit data... | |
doc | Loading commit data... | |
drivers | Loading commit data... | |
editor | Loading commit data... | |
main | Loading commit data... | |
misc | Loading commit data... | |
modules | Loading commit data... | |
platform | Loading commit data... | |
scene | Loading commit data... | |
servers | Loading commit data... | |
thirdparty | Loading commit data... | |
.appveyor.yml | Loading commit data... | |
.clang-format | Loading commit data... | |
.clang-tidy | Loading commit data... | |
.editorconfig | Loading commit data... | |
.gitattributes | Loading commit data... | |
.gitignore | Loading commit data... | |
.mailmap | Loading commit data... | |
.travis.yml | Loading commit data... | |
AUTHORS.md | Loading commit data... | |
CHANGELOG.md | Loading commit data... | |
CODE_OF_CONDUCT.md | Loading commit data... | |
CONTRIBUTING.md | Loading commit data... | |
COPYRIGHT.txt | Loading commit data... | |
DONORS.md | Loading commit data... | |
LICENSE.txt | Loading commit data... | |
LOGO_LICENSE.md | Loading commit data... | |
README.md | Loading commit data... | |
SConstruct | Loading commit data... | |
gles_builders.py | Loading commit data... | |
icon.png | Loading commit data... | |
icon.svg | Loading commit data... | |
logo.png | Loading commit data... | |
logo.svg | Loading commit data... | |
methods.py | Loading commit data... | |
platform_methods.py | Loading commit data... | |
version.py | Loading commit data... |