Giter VIP home page Giter VIP logo

cppclean's Introduction

cppclean

Build status Test coverage status

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: https://code.google.com/p/cppclean/

Features

  • Find and print C++ language constructs: classes, methods, functions, etc.
  • Find classes with virtual methods, no virtual destructor, and no bases
  • Find global/static data that are potential problems when using threads
  • Unnecessary forward class declarations
  • Unnecessary function declarations
  • Undeclared function definitions
  • Find unnecessary header files #included
    • No direct reference to anything in the header
    • Header is unnecessary if classes were forward declared instead
  • (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

AST is Abstract Syntax Tree, a representation of parsed source code. http://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)

cppclean's People

Contributors

myint avatar r-e-d avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.