Giter VIP home page Giter VIP logo

inconsistency-checker's Introduction

Inconsistency Checker

This tool is a Python code analyzer that can find method resolution order (mro) and cycle inconsistencies in Python libraries. mro inconsistencies refer to the mismatches found from attempted mro linearization, and cycle inconsistencies refer to cyclic class inheritance.

Usage

  1. Generate the class hierarchy graph pickle dump file with
python get_class_hierarchy_graph.py [path to Python source code]

The path can be to either a Python script or a folder that contains Python source code. get_class_hierarchy_graph.py creates a folder named class_hierarchy_graphs if not created and generates the pickle dump file in that folder: class_hierarchy_graphs/<name of Python script or folder>_class_hierarchy_graph.pkl.

  1. Use the following script to scan the class hierarchy graph stored in the pickle dump file for mro and cycle inconsistencies:
python check_inheritance_consistency.py [path to pickle dump file]

If found, the script outputs found cycle and mro inconsistencies and creates folders cycle_inconsistent_info and source_logical_inconsistent_info if not created. Information on found cycle inconsistencies, the classes in a cycle, is dumped in cycle_inconsistent_info/<name of Python script or folder>.txt, and information on found logical inconsistencies, the classes with inconsistent mro, is dumped in source_logical_inconsistent_info/<name of Python script or folder>.txt. Source logical inconsistencies refer to the found mro inconsistencies.

The output has names of classes prepended by the path in dot notation relative to the root of the provided source code. For example, class X in sample_inconsistent_codebase/a.py is referred to as sample_inconsistent_codebase.a.X.

Example Usage

python get_class_hierarchy_graph.py sample_inconsistent_codebase
python check_inheritance_consistency.py class_hierarchy_graphs\sample_inconsistent_codebase_class_hierarchy_graph.pkl

inconsistency-checker's People

Contributors

jesshua159 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.