Giter VIP home page Giter VIP logo

methods-distance's Introduction

Build Status Build status

Running:

  • clone sources
  • compile:
mvn package
  • run java -jar methods-distance/target/methods-distance-1.0-SNAPSHOT-jar-with-dependencies.jar --generate-dsm --generate-dot path/to/sources/InputFile.java

This will produce files 'InputFile.java.html' and 'InputFile.java.dot' in working directory.

Alternatively you can try to use web service for generating these files. Web service is hosted at herooku. To get .html file perform GET request at /dsm uri with parameter source_url pointing to url of Java source file. For example: https://methods-distance.herokuapp.com/dsm?source_url=https://raw.githubusercontent.com/checkstyle/checkstyle/b4e884c2ff3bef182b045692b59c1aceae3cb892/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java

To get .dot file perform GET request using /dot uri with parameter source_url. For example https://methods-distance.herokuapp.com/dot?source_url=https://raw.githubusercontent.com/checkstyle/checkstyle/b4e884c2ff3bef182b045692b59c1aceae3cb892/src/main/java/com/puppycrawl/tools/checkstyle/Checker.java

Output .html file will contain design structure matrix of dependencies between methods. This matrix looks like this java file: DSM example

Output .dot file will contain graph of method dependencies in .dot format that can be visualized by many viewers. Viewers:

As an example, here is the output for this java file:

digraph "dependencies" {
rankdir = "LR";
"process(List)" [ color="#00ff00" shape="ellipse" ];
"processFiles(List)" [ color="#000000" shape="ellipse" ];
"Checker()" [ color="#00ff00" shape="ellipse" ];
"setupChild(Configuration)" [ color="#ffff00" shape="trapezium" ];
subgraph clustersimple {
"processFile(File)" [ color="#000000" shape="ellipse" ];
"addFilter(Filter)" [ color="#00ff00" shape="ellipse" ];
"fireFileFinished(String)" [ color="#00ff00" shape="trapezium" ];
"fireFileStarted(String)" [ color="#00ff00" shape="trapezium" ];
"fireAuditStarted()" [ color="#000000" shape="ellipse" ];
"fireErrors(String,SortedSet)" [ color="#00ff00" shape="trapezium" ];
"getExternalResourceLocations()" [ color="#000000" shape="ellipse" ];
"addFileSetCheck(FileSetCheck)" [ color="#00ff00" shape="ellipse" ];
"fireAuditFinished()" [ color="#000000" shape="ellipse" ];
"addListener(AuditListener)" [ color="#00ff00" shape="ellipse" ];
}
"process(List)" -> "getExternalResourceLocations()" [ label="1/35" ];
"process(List)" -> "fireAuditStarted()" [ label="2/55" ];
"process(List)" -> "processFiles(List)" [ label="4/76" ];
"process(List)" -> "fireAuditFinished()" [ label="3/63" ];
"processFiles(List)" -> "fireFileStarted(String)" [ label="2/58" ];
"processFiles(List)" -> "processFile(File)" [ label="1/35" ];
"processFiles(List)" -> "fireErrors(String,SortedSet)" [ label="3/73" ];
"processFiles(List)" -> "fireFileFinished(String)" [ label="4/92" ];
"Checker()" -> "addListener(AuditListener)" [ label="19/327" ];
"setupChild(Configuration)" -> "addFileSetCheck(FileSetCheck)" [ label="1/43" ];
"setupChild(Configuration)" -> "addFilter(Filter)" [ label="2/52" ];
"setupChild(Configuration)" -> "addListener(AuditListener)" [ label="3/60" ];
/*
Legend
Node border color:
    a) GREEN - public
    b) YELLOW - protected
    c) BLACK - private
    d) BLUE - default
Node shape:
    if static - rectangle
    otherwise if override - trapezium
    otherwise if overloaded - triangle
    otherwise ellipse
*/
}

This graph looks like this: Graph example

methods-distance's People

Contributors

alex-zuy avatar dependabot[bot] avatar github-actions[bot] avatar haanhvu avatar josephmate avatar nrmancuso avatar rahulkhinchi03 avatar rnveach avatar romani avatar strkkk avatar vyom-yadav avatar wilcoln 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.