LinuxCommandLibrary

cpplint

TLDR

Check single file

$ cpplint [file.cpp]
copy
Check multiple files
$ cpplint [file1.cpp] [file2.cpp]
copy
Recursive directory check
$ cpplint --recursive [src/]
copy
Filter specific categories
$ cpplint --filter=-whitespace,+build [file.cpp]
copy
Set line length
$ cpplint --linelength=[120] [file.cpp]
copy
Output in different format
$ cpplint --output=[vs7] [file.cpp]
copy

SYNOPSIS

cpplint [options] files

DESCRIPTION

cpplint is a static code checker for C++ that verifies code against Google's C++ style guide. It checks for style errors, formatting issues, and common programming mistakes.
Originally developed by Google, now maintained as an open-source project.

PARAMETERS

--recursive

Check files in subdirectories recursively
--filter=-/+categories
Enable/disable specific warning categories
--linelength=length
Maximum line length (default 80)
--extensions=list
File extensions to process
--headers=list
Header file extensions
--output=format
Output format: emacs, vs7, eclipse, junit, sed, gsed
--counting=type
Count errors: total, toplevel, detailed
--root=dir
Project root for header guard paths
--exclude=pattern
Exclude files matching pattern

FILTER CATEGORIES

- build: Build-related issues
- legal: Copyright/license issues
- readability: Code readability
- runtime: Runtime issues
- whitespace: Spacing and formatting
Prefix with - to disable, + to enable.

CAVEATS

Designed specifically for Google style guide compliance. Some rules may not apply to all projects. Use CPPLINT.cfg file for project-wide configuration.

SEE ALSO

Copied to clipboard