Git Product home page Git Product logo

chaos-meter's Introduction

Chaos Meter

Chaos meter measure various metrics of a dependency graph. Those metrics represent the software entropy. Unlike the classic code analyser tools, Chaos Meter focuses on the dependencies between the components of a software project. The goal is to provide a better understanding of an existing software architecture and to identify potential issues.

Steps:

  • Build the project graph
  • Analyse the graph

Build the project graph

Currently, the tool supports building the graph of javascript, typescript and java projects.

Typescript graph

To build the graph of a frontend project, you need to install Madge. Madge is a tool that generates a graph of your file dependencies. It works with both CommonJS and ES6 module syntax, and it works with both JavaScript and TypeScript.

Install Madge globally:

npm install -g madge

Execute this command to build the graph:

madge --extensions ts --exclude '.*.spec.ts' ./src > project-name.madge

Java graph

To build the graph of a backend project, we use jdeps. jdeps is a tool that generates a graph of your file dependencies. jdeps is able to analyse a jar but is not able to recursively analyse a fat jar.

For applications that are not modularized, you can use the following command to generate the graph:

jdeps -verbose:class -e com.example.* application-jar.jar > project-name.jdeps

For applications that are modularized (i.e hexagonal applications), you can use a similar command to generate the graph:

jdeps -verbose:class -e com.example.*  **/target/**SNAPSHOT.jar > project-name.jdeps

Note that the -e flag is used to only include the se.hms package in the graph.

Another way could be to unpack the fat jar and target the relevant jars in a single call to jdeps like in the previous example.

Usage

usage: Software Entropy calculator [-h] -g GRAPH -m {cycle,in-degree,out-degree,centrality-degree,flow-hierarchy,density,topology} [-e EXCLUDE]

Tool used to measure various metrics of a software dependency graph.

options:
  -h, --help            show this help message and exit
  -g GRAPH, --graph GRAPH
                        The file containing the dependency graph. Example: "path/to/graph.<jdeps|madge|graph>"
  -m {cycle,in-degree,out-degree,centrality-degree,flow-hierarchy,density,topology}, --metric {cycle,in-degree,out-degree,centrality-degree,flow-hierarchy,density,topology}
                        The metric to output
  -e EXCLUDE, --exclude EXCLUDE
                        Regex to identify the components to be excluded from the analysis. This allows to differentiate models from logical components and have more relevant results. Example: ".*\.model\..*|.*\.entity\..*|.*\.dto\..*"

Examples

Compute the density of a graph

python3 chaosmeter.py -g path/to/graph -m density

Compute the topology of a graph by excluding models from the analysis

python chaosmeter.py -g path/to/graph -e ".*\.model\..*|.*\.entity\..*|.*\.dto\..*" -m topology

chaos-meter's People

Contributors

wood-chopper avatar

Stargazers

Fabrizio Giugno avatar

Watchers

 avatar

chaos-meter's Issues

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.