Caffe2 - Python API
A deep learning, cross platform ML framework
Functions | Variables
tools.clang_tidy Namespace Reference


def run_shell_command (arguments)
def split_negative_from_positive_patterns (patterns)
def get_file_patterns (globs, regexes)
def filter_files (files, file_patterns)
def get_changed_files (revision, paths)
def get_all_files (paths)
def get_changed_lines (revision, filename)
def run_shell_commands_in_parallel (commands)
def run_clang_tidy (options, line_filters, files)
def parse_options ()
def main ()



Detailed Description

A driver script to run clang-tidy on changes detected via git.

By default, clang-tidy runs on all files you point it at. This means that even
if you changed only parts of that file, you will get warnings for the whole
file. This script has the ability to ask git for the exact lines that have
changed since a particular git revision, and makes clang-tidy only lint those.
This makes it much less overhead to integrate in CI and much more relevant to
developers. This git-enabled mode is optional, and full scans of a directory
tree are also possible. In both cases, the script allows filtering files via
glob or regular expressions.

Function Documentation

def tools.clang_tidy.filter_files (   files,
Returns all files that match any of the patterns.

Definition at line 90 of file

def tools.clang_tidy.get_all_files (   paths)
Returns all files that are tracked by git in the given paths.

Definition at line 112 of file

def tools.clang_tidy.get_changed_files (   revision,
Runs git diff to get the paths of all changed files.

Definition at line 103 of file

def tools.clang_tidy.get_changed_lines (   revision,
Runs git diff to get the line ranges of all file changes.

Definition at line 118 of file

def tools.clang_tidy.get_file_patterns (   globs,
Returns a list of compiled regex objects from globs and regex pattern strings.

Definition at line 72 of file

def tools.clang_tidy.parse_options ( )
Parses the command line options.

Definition at line 193 of file

def tools.clang_tidy.run_clang_tidy (   options,
Executes the actual clang-tidy command in the shell.

Definition at line 159 of file

def tools.clang_tidy.run_shell_command (   arguments)
Executes a shell command.

Definition at line 46 of file

def tools.clang_tidy.run_shell_commands_in_parallel (   commands)
runs all the commands in parallel with ninja, commands is a List[List[str]]

Definition at line 144 of file

def tools.clang_tidy.split_negative_from_positive_patterns (   patterns)
Separates negative patterns (that start with a dash) from positive patterns

Definition at line 60 of file