GithubHelp home page GithubHelp logo

dezzydez007 / contract-complexity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from etsangsplk/contract-complexity

0.0 1.0 0.0 207 KB

Complexity analyzer for Solidity smart contracts

Home Page: https://web.solidified.io

Jupyter Notebook 90.18% Python 9.82%

contract-complexity's Introduction

Code Complexity Estimator for Smart Contracts

Author: Oskar Triebe, February 2018

Purpose

This is a scoring tool to estimate the complexity of a project based on its source code. It is designed for smart contracts based on Solidity. However, it could easily be repurposed for Python or other languages.

Use

High-level overview: Given a path to a the source code filesystem, the scoring tool computes a complexity score in the range of [0, 1].

Call Scorer (Python)

Call get_project_score from scoring_tool/scoring_tool.py with arguments:

get_project_score(
    setup_args, 
    project_class, 
    project_name,
)

With setup_args = setup_args = load_setup_args(setup_path) being a dict with setup arguments loaded from setup_path containing setup.json, weights.json, categoric_norm.json, numeric_norm.json. For an example, see scoring_tool/setup/.

Call Scorer (Commandline)

Call scoring_tool/scoring_tool.py --setup_path <path_to_setup_files>. For details on setup_path, see above or see implementation in main() for example.

Call Scorer with JSON payload (Python)

Call payload2score from scoring_tool/web_integration.py with arguments:

payload2score(
    setup_args, 
    json_payload, 
    use_tmp_dir,
)

This is a wrapper around get_project_score, which creates a temporary filesystem from the project data contained in the JSON payload.

Call Scorer with JSON payload (Commandline)

Just like above, call web_integration/payload2score.py --setup_path <path_to_setup_files> --payload_file <payload_file> . Additionally supply payload_file: path and filename of JSON payload.

Notes

Filesystem assumes the structure <data_path>/<project_class>/<project_name>/<nested repo with src files>

contract-complexity's People

Contributors

ourownstory avatar

Watchers

 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.