Find problems in C++ source that slow development of large code bases.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file cppclean-0.13.tar.gz
.
File metadata
- Download URL: cppclean-0.13.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 704e844f4340d4fd5bcaa9cd0095389d348f11548628f7054d8eb95463d72109 |
|
MD5 | 3dc2f4f4ae0001ed3eaa377a3107c68d |
|
BLAKE2b-256 | e372f19e794a81dcbfe637a4e8b10b5de12a5cd798ae63653b4fb05886db2bb7 |