Functions | |
def | parse_args () |
def | get_whitelisted_files () |
def | get_changed_files (rev) |
def | get_diffs (files) |
def | main () |
Variables | |
CLANG_FORMAT_WHITELIST | |
CPP_FILE_REGEX | |
A script that runs clang-format on changes detected via git. It will report if running clang-format generated any changes. In CI, the script considers it a failure if running clang-format makes a change. In the pre-commit hook, the user is prompted to apply any clang-format changes. Running tools/clang_format.py manually with no arguments should replicate the pre-commit hook behavior. Only files that are in CLANG_FORMAT_WHITELIST are checked.
def tools.clang_format.get_changed_files | ( | rev | ) |
Get all changed files between the working tree and `rev`
Definition at line 71 of file clang_format.py.
def tools.clang_format.get_diffs | ( | files | ) |
Run clang-format on all `files` and report if it changed anything. Returns a mapping of filename => diff generator
Definition at line 85 of file clang_format.py.
def tools.clang_format.get_whitelisted_files | ( | ) |
Parse CLANG_FORMAT_WHITELIST and resolve all directories. Returns the set of whitelist cpp source files.
Definition at line 57 of file clang_format.py.