cppclean
Goal
cppclean attempts to find problems in C++ source that slow development in large code bases, for example various forms of unused code. Unused code can be unused functions, methods, data members, types, etc to unnecessary #include directives. Unnecessary #includes can cause considerable extra compiles increasing the edit-compile-run cycle.
This is a fork of the original cppclean project. The original project home page, which no longer contains code, is at https://code.google.com/p/cppclean/.
Features
cppclean finds the following:
Classes with virtual methods, no virtual destructor, and no bases
Global/static data that are potential problems when using threads
Functions that are declared but not defined
Unnecessary forward class declarations
Unnecessary function declarations
Undeclared function definitions
- Unnecessary #includes in header files
No direct reference to anything in the header
Header is unnecessary if classes were forward declared instead
Inconsistent case in #includes (foo.h versus Foo.h)
(planned) Unnecessary #includes in source files
(planned) Source files that reference headers not directly #included, ie, files that rely on a transitive #include from another header
(planned) Unused members (private, protected, & public) methods and data
(planned) using namespace std in header files
(planned) Methods that are declared but not defined
AST is Abstract Syntax Tree, a representation of parsed source code (https://en.wikipedia.org/wiki/Abstract_syntax_tree).
Installation
$ pip install --upgrade cppclean
Run
$ cppclean <path>
Multiple include paths can be specified:
$ cppclean --include-path=directory1 --include-path=directory2 <path>
Current status
The parser works pretty well for header files, parsing about 99% of Google’s header files. Anything which inspects structure of C++ source files should work reasonably well. Function bodies are not transformed to an AST, but left as tokens.
Non-goals
Parsing all valid C++ source
Handling invalid C++ source gracefully
Compiling to machine code (or anything beyond an AST)
Links
Metadata
Release files for cppclean 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cppclean-0.10.tar.gz | 29.2 kB | Without provenance | Details |
Release files / cppclean-0.10.tar.gz
| Download URL | cppclean-0.10.tar.gz |
|---|---|
| Size | 29.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b368ebf9a30b766e36c0ef0cc24e58ecc9d2b40a032881fdab8e7f1e39eee8ec
|
|
BLAKE2b-256 checksum How to use checksums |
c8e7d551892c2879abd7fa45614472a6df388728b2b4934f717a5ac340d49e2e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for cppclean 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.