rakhimov / cppdep Goto Github PK
View Code? Open in Web Editor NEWC/C++ Dependency Analyzer: a rewrite of John Lakos' dep_utils (adep/cdep/ldep) from "Large-Scale C++ Software Design"
License: GNU General Public License v3.0
C/C++ Dependency Analyzer: a rewrite of John Lakos' dep_utils (adep/cdep/ldep) from "Large-Scale C++ Software Design"
License: GNU General Public License v3.0
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.
For example, Qt and STL provide header files without extensions.
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
.
Proper documentation for the code.
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
...we consider classes that refer to more than 20 other classes and which are referred to by more than 20 other classes as critical. On the level of subsystems the critical limit is 10 referring and referred to subsystems.
Klaus Wolfmaier and Rudolf Ramler:
Common Findings and Lessons Learned from Software Architecture and Design Analysis
An example issue is the UIC auto-generated headers in user projects.
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).
This is relevant when pairing files into components.
Currently, report and warnings are mixed into stdout.
Even though templates are only in headers,
ipp files could be considered as implementation pair of the interface header.
This occurs, for example, in Boost. #29.
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.
Analyze files/packages concurrently. Add '-j' flag.
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.
The main seems to be called twice per run.
An option to report the analysis results into separate report files per package/group/graph-type
in the same manner as graph dot files are produced.
The original code lacks tests and relies on manual testing via the main test driver.
yaml as a potential alternative.
Header and implementation files can be located in different directories, e.g., headers in include
and implementation in src
.
The current implementation assumes the same location.
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.
The components are described with levels in the CCD approach.
The current implementation reports graph layers instead.
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.
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
setup.py
locally behaves differently than pip install
;
as a result, the schema file is ending in different places
unexpected by the modules.
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.
If both implementation and header include the same header,
the included header may be redundant in either of them (e.g., refactoring artifact).
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
Cycles must add extra levels as described in the book.
The current implementation doesn't seem to calculate levels this way.
Heavy C code with some extern declarations.
Incorporation of include-wrangler analysis
In collaboration with include-wrangler author @lukedodd
Cycles are stripped for some reason from the dependency graph.
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.
Related to #18.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.