We use the Google C++ Style Guide.
Our continuous integration server lints all code when it’s pushed to a branch or added to a pull request. Your build will fail if it does not meet our style standards.
Here are the basic rules of the Google C++ Style Guide:
It’s a good idea to get familiar with the tools used by our CI server so you can lint and reformat your code locally.
We lint C++ projects with cpplint and reformat code with clang-format.
brew install clang-format
pip install cpplint
# Lint files for Google style
cpplint [FILES...] [DIRECTORIES...]
# Reformat files using Google style
clang-format -style=Google -i [FILES...] [DIRECTORIES...]
Individual projects may have configurations for cpplint or clang-format already included.
clang-format uses the .clang-format
file to set formatting style. See the clang-format docs for more info.
cpplint is configured in CPPLINT.cfg
. See the cpplint.py source for more info on configuration options and linter filters.