Code Monkey home page Code Monkey logo

cppdep's People

Contributors

rakhimov avatar yuzhichang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cppdep's Issues

Windows: Unicode Escape Error NetworkX, pydotplus and Python 2.7

If component/project names contain paths as identifiers,
the path separator on Windows \ followed by 'U' or 'u' is interpreted as a Unicode literal
by pydotplus plotting on Windows with python 2.7.

This problem does not show up on python 3.

For the sake of consistency in the report (stable report) and testing,
use Unix path separator in Ids.

Redundant 'ldep' printing of cumulative dependencies

Unlike the original ldep,
the cppdep is printing the whole cumulative dependencies;
that is, the all link time dependencies are printed.
This information is visually provided in the graph,
and implicitly provided in the original ldep '-l | -L' flags.

It seems like the current implementation of the cumulative dependency printing
is geared towards debugging rather than analysis report.

Fix this printing by implementing the original behavior of ldep.

Python 3.6 os.path.commonprefix expects List

  File "/.../cppdep/cppdep.py", line 92, in path_common
    path = os.path.commonprefix(paths)
  File "/home/olzhas/temp/pyenv/lib/python3.6/genericpath.py", line 76, in commonprefix
    if not isinstance(m[0], (list, tuple)):
TypeError: 'set' object does not support indexing

Extended definition for 'Component'

Even though John Lakos defined a component as a pair of h and c files,
C++ can have template only components
residing only in header files (e.g., STL/Boost/etc.).
Moreover, some header-only components
may contain only inline functions or macros
without any need for an implmentation file (e.g., inline math, Boost PPL).
For these reason, unpaired header files can be counted as components by default.

In addition, the implementation file containing the main function of an application could be considered as a component as well (an entry point).

Analysis without a configuration file

An ability to run the tool with command-line arguments only.
Deduce package name and include paths from the command-line arguments,
the current directory, and the system.

Double counting of common components in CCD

The current implementation overcounts link time dependencies with common components deep in the dependency graph.
Consider: A->B->C, A->D->C. CCD(A) must be 4 (4 object files in total.) The current approach overcounts the common object C, so CCD(A) ends up being 5.

Automated Tests

The original code lacks tests and relies on manual testing via the main test driver.

  • Unit tests
  • Analysis validation
  • Performance tests

Options to disable/enable warnings

  • Duplicate include
  • Redundant (transitive from the component header) include
  • Missing a component header (incomplete component)
  • Failure to locate a header from an include directive

Incorrect dependency processing with file basenames

The current implementation uses the basename of the included files as the key in dependency search.
This approach ignores the current location of the dependent files and the language include rules, i.e. <header.h> vs. "header.h".
Moreover, it results in name conflicts for files that may belong to completely separate projects or packages.

Analysis from CMake file

As a CMake user, I don't want to have to create another project configuration file to specify my product structure. cppdep should be able to use CMake to gather this information. This might be done with a build generator or it might be done via APIs that I understand CMake is making available for IDEs.

Missing 'pydot' dependency fails on networkx nx_pydot

Traceback (most recent call last):
  File "/.../python3env/bin/cppdep", line 11, in <module>
    sys.exit(main())
  File "/.../python3env/lib/python3.5/site-packages/cppdep/__main__.py", line 59, in main
    analysis.analyze(printer, args)
  File "/.../python3env/lib/python3.5/site-packages/cppdep/cppdep.py", line 797, in analyze
    lambda x: isinstance(x, PackageGroup)))
  File "/.../python3env/lib/python3.5/site-packages/cppdep/cppdep.py", line 779, in _analyze
    digraph.write_dot(graph_name)
  File "/.../python3env/lib/python3.5/site-packages/cppdep/graph.py", line 273, in write_dot
    write_dot(self.digraph, file_basename + '.dot')
  File "<decorator-gen-416>", line 2, in write_dot
  File "/.../python3env/lib/python3.5/site-packages/networkx/utils/decorators.py", line 224, in _open_file
    result = func(*new_args, **kwargs)
  File "/.../python3env/lib/python3.5/site-packages/networkx/drawing/nx_pydot.py", line 54, in write_dot
    P = to_pydot(G)
  File "/.../python3env/lib/python3.5/site-packages/networkx/drawing/nx_pydot.py", line 199, in to_pydot
    pydot = _import_pydot()
  File "/.../python3env/lib/python3.5/site-packages/networkx/drawing/nx_pydot.py", line 348, in _import_pydot
    import pydot

Behavior specification for anomalous conflicting component files

Anomalous (rare, error) case of having "component.c" and "component.cc"
or "component.h" and "component.hpp" at the same time trying to define the same component.
In other words, files with the same basenames but different extensions in header and/or source groups.

Warn about redundant includes

If both implementation and header include the same header,
the included header may be redundant in either of them (e.g., refactoring artifact).

Missing graph module

I've just installed this project, tried to run it but I get this error message.

Traceback (most recent call last):
  File "cppdep.py", line 36, in <module>
    from .graph import Graph
ModuleNotFoundError: No module named '__main__.graph'; '__main__' is not a package

Wrong Level for Cycles

Cycles must add extra levels as described in the book.
The current implementation doesn't seem to calculate levels this way.

Deduce external packages from the include directives w/o filesystem search

The package can be deduced from the include directives following the pattern: "<package/header>",
e.g., "<boost/any.hpp>".
This approach will avoid the relatively expensive lookup of the header from the system.
Whether such external header actually exists on the system or not is irrelevant to the dependency analysis.

This heuristic would make the configuration simpler and more robust for cross-platform work.

In addition, the standard library headers can be "hard-coded" into the script
since these are the most likely to be used/searched by the source files.

There's a small chance of false positives
if the project under analysis happens not to conform to this convention
and invents its own packages with the same names as external ones,
e.g., boost, qt, libxml.

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.