C++ code should conform to Google C++ Style Guide.
Addons uses clang-format to check your C/C++ changes. Sometimes you have some manually formatted code that you don’t want clang-format to touch. You can disable formatting like this:
int formatted_code;
// clang-format off
void unformatted_code ;
// clang-format on
void formatted_code_again;
Python code should conform to PEP8.
Addons uses yapf to format code, and pylint for code analysis. You can disable them locally like this:
# yapf: disable
FOO = {
# ... some very large, complex data literal.
}
BAR = [
# ... another large data literal.
]
# yapf: enable
# pylint: disable=protected-access
foo._protected_member
# pylint: enable=protected-access
Follow the guidance in the TensorFlow Style Guide - Conventions.
Please note that Addons follows the conventions of the TensorFlow library, but formats our code using PEP8 guidelines.