Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sjednac/coffea
Static dependency analyzer for Java bytecode.
https://github.com/sjednac/coffea
code-analysis dependency-analysis java jvm python
Last synced: 26 days ago
JSON representation
Static dependency analyzer for Java bytecode.
- Host: GitHub
- URL: https://github.com/sjednac/coffea
- Owner: sjednac
- License: apache-2.0
- Created: 2013-10-19T10:50:26.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2017-01-03T15:05:31.000Z (almost 8 years ago)
- Last Synced: 2024-04-16T18:58:25.190Z (7 months ago)
- Topics: code-analysis, dependency-analysis, java, jvm, python
- Language: Python
- Size: 500 KB
- Stars: 14
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
******
Coffea
******Coffea is a command line tool and Python library for analyzing **static dependences** in **Java** bytecode. Features:
* Class processing handled entirely in Python (i.e. no JVM dependency and no class loader issues)
* Recursive processing of directories (e.g. exploded deployments) and basic archive formats (jar, war and ear)
* Package or class based dependency models
* Node weight based on actual code size (i.e. bytecode size)
* Node filters and mappers for basic noise reduction (eg. removing certain packages from the model or folding several packages into one node)
* Basic graph visualisation using *matplotlib*
* Exporting to common graph formats using standard *networkx* facilities (eg. dot, gml or graphml)Usage
=====Run the command-line tool (use ``coffea -h`` for a complete list of options)::
$ coffea -i
Example
=======Modelling `JBoss AS 7.x `_ internal dependency structure::
$ coffea -p -i /opt/jboss-7.2.0.GA/modules/ -Ip org.jboss. -Mrp org.jboss. -Mep 0 -El logging
Interactive mode equivalent::
>>> from coffea.builder import Builder
>>> from coffea.analyzer import Plotter
>>> from coffea.model import NodeIdFilter, NodeIdMapper
>>> b = Builder()
>>> b.model.node_filters.append(NodeIdFilter(lambda it: it.startswith('org.jboss.')))
>>> b.model.node_filters.append(NodeIdMapper(lambda it: it.replace('org.jboss.', '')))
>>> b.model.node_filters.append(NodeIdMapper(lambda it: it.split('.')[0]))
>>> b.model.node_filters.append(NodeIdFilter(lambda it: it not in ['logging']))
>>> b.append('/opt/jboss-7.2.0.GA/modules/')
No handlers could be found for logger "scanner"
>>> print len(b.model.nodes)
48
>>> p = Plotter(b.model)
>>> p.plot()
[Displays an interactive view of the dependency model]
>>> p.plot(filename='/tmp/jboss7_module_dependencies.png')Output:
.. image:: examples/output/jboss_as_7.png
:alt: JBoss 7.x internal dependencies
:width: 40pt
Unit testing
============You can run the test suite directly from the command line::
$ python -m unittest discover