CppLint

The tool performs checking for compatibility of code with Google’s style guide for C++ language, which ensures code to be clean from bad practices and more se cure. It also checks for syntax errors and style consistency.

Installation

CppLint is a Python script and can be easily installed in every environme nt that has also the Python's package manager (pip) installed. Use the fo llowing command to do so:

pip install cpplint

Usage

Basic run

The basic usage of CppLint is very simple:

cpplint [--exclude=<paths>] <directory/file&
gt;

Where:

  • <paths> - comma separated list of paths (files, directo ries) that should not be checked
Examples
cpplint ./code/*
cpplint --exclude=./magic/ ./*

Warning

CppLint bases on regular expressions and occasionally may report false-po sitive warnings; it is possible to suppress scanning in specific parts of code b y adding the following comment at the end of each impacted line:

// NOLINT

It is possible (and better) to suppress warnings for a only one specific rule, using:

// NOLINT(RULE)