cpplint is a command-line tool that checks C and C++ source files for violations of Google’s C++ style guide. It helps developers maintain consistent coding conventions and identify common style problems before changes are committed.
The software originated at Google, but development of the public version has moved to a community-maintained fork. This fork adds support for modern C++ constructs, additional file extensions and more flexible configuration.
cpplint concentrates on coding conventions rather than comprehensive bug detection. It examines issues such as whitespace, header guards, naming conventions and include ordering, with configurable filters for adapting its checks to different projects.
This is free and open source software.
Key Features
- Checks C and C++ source files against Google’s C++ style guidelines.
- Detects formatting, whitespace, naming and include-related issues.
- Checks header guards and supports pragma once as an alternative.
- Recursive scanning of directories containing source files.
- Configurable file extensions and exclusion patterns.
- Adjustable maximum line length and diagnostic verbosity.
- Enable or disable categories of warnings using filters.
- Suppress individual diagnostics or entire code blocks using NOLINT comments.
- Supports custom configuration files for project-specific rules.
- Output formats suitable for Emacs, Eclipse, Visual Studio and JUnit-compatible tools.
- Generate summaries of violations by category.
- Integration with pre-commit hooks and continuous integration systems.
- Support for modern C++ syntax and common header-file conventions.
Website: github.com/cpplint/cpplint
Support:
Developer: cpplint contributors, based on Google’s original tool
License: BSD 3-Clause “New” or “Revised” License
cpplint is written in Python. Learn Python with our recommended free books and free tutorials.
Related Software
| C and C++ Linters | |
|---|---|
| OCLint | Static code analysis tool for improving quality and reducing defects |
| cpplint | Static code checker for C++ |
| CodeChecker | Platform for running static analysers and managing code defects |
| Uncrustify | Source code beautifer |
| Infer | Static analyser that detects bugs in Java, C and C++ code |
| Include What You Use | Source analysis tool for C and C++ projects built on Clang |
| Cppcheck | Static analysis tool for C/C++ code |
| flawfinder | Scans C and C++ source code for potential security weaknesses |
| clazy | Qt-focused static analyser that catches common C++ mistakes |
| ClangFormat | Code formatting tool |
| Clang-Tidy | Clang-based C++ “linter” tool |
| Smatch | Static analysis tool for finding defects in C code |
| Coccinelle | Semantic patching tool for analysing and transforming C code |
Read our verdict in the software roundup.
Explore our carefully curated directory of recommended free and open source software, covering every major software category.The directory forms part of our extensive collection of articles for Linux enthusiasts. It includes hundreds of detailed reviews, together with free and open source alternatives to proprietary software from companies such as Google, Microsoft, Apple, Adobe, IBM, Cisco, Oracle, and Autodesk. LinuxLinks also covers interesting projects worth exploring, Linux-compatible hardware, free programming books and tutorials, and much more. Know a useful free and open source Linux application that we haven’t covered? Tell us about it using our submission form. |


Please read our Comment Policy before commenting.