Read the code, and follow the existing style as much as possible.
For C++, Java and Objective C/C++ code we use clang-format.
Install clang-format 21.0+ and make sure it's in your PATH.
- To manually format a file run
clang-format -i file. - To format all files in the repository run
tools/unix/clang-format.sh - To format changes added to commit run
git clang-format - To format already committed changes run
git clang-format HEAD~1
- Install this plugin: https://plugins.jetbrains.com/plugin/20785-clang-format-tools
- Then go to Preferences -> Other Settings -> ClangFormat and set the path to your installed
clang-formatbinary. - Enable "Reformat code on file save" option.
Install and setup the Clang-Format extension.
We are using swiftformat for Swift code. Install it and configure format on save in Xcode by following instructions at https://medium.com/@jozott/format-on-save-xcode-swift-8133d049b3ac
Follow the existing style in Python files as much as possible. We'll add a more detailed guide later.
- Check the existing code base for examples of how to do things, and to reuse existing utilities and functions
- Write the code without warnings
- If you see outdated code which can be improved, DO IT NOW (but in a separate pull request or commit)!
- Your code should work at least on [mac|linux|android][x86|x86_64], [ios|android][x86|armv7|arm64] architectures
- Your C++ code should compile with C++23 compiler
- Avoid using any new 3party library if it is not fully tested and supported on all our platforms
- Cover your code with unit tests. See examples for existing libraries
- Ask if you have any questions
- If you don't have enough time to make it right, or see a potential issue, leave a
// TODO(DeveloperName): need to fix itcomment