Jump to >

Cpplint

Cpplint is a tool which checks C++ code against Google’s style guide.

Supported File Types

The following are supported by this tool:

  • C/C++: *.c, *.cc, *.cpp, *.cu, *.cuh, *.cxx, *.c++, *.h, *.hh, *.hpp, *.hxx, *.h++

Installation

cpplint can be installed on most systems by running:

$ pip install cpplint

It may also be available in your system’s package manager.

Configuration

Cpplint Location

If the cpplint command is in a non-standard location, and can’t be found in Review Bot’s PATH environment variable, then you’ll need to specify the path in the Review Bot worker config file:

exe_paths = {
    'cpplint': '/path/to/cpplint',
}

You will need to restart the Review Bot worker after making this change.

Enabling Cpplint in Review Board

First, you’ll need to add a Review Bot configuration in Review Board (see Tool Configurations).

The following configuration options are available:

Verbosity level for Cpplint (required):

The level of verbosity for error reporting. This is a number between 1 and 5, where 1 will report all warnings/errors, and 5 will report only the most severe.

This is equivalent to cpplint --verbose=....

Tests to exclude (optional):

A comma-separated list of tests to exclude.

You can see available options by running cpplint --filter= locally. This is equivalent to passing the filter names to that option.