Coding

cpplint – static code checker for C and C++

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
OCLintStatic code analysis tool for improving quality and reducing defects
cpplintStatic code checker for C++
CodeCheckerPlatform for running static analysers and managing code defects
UncrustifySource code beautifer
InferStatic analyser that detects bugs in Java, C and C++ code
Include What You UseSource analysis tool for C and C++ projects built on Clang
CppcheckStatic analysis tool for C/C++ code
flawfinderScans C and C++ source code for potential security weaknesses
clazyQt-focused static analyser that catches common C++ mistakes
ClangFormatCode formatting tool
Clang-TidyClang-based C++ “linter” tool
SmatchStatic analysis tool for finding defects in C code
CoccinelleSemantic patching tool for analysing and transforming C code

Read our verdict in the software roundup.


Best Free and Open Source Software 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.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted