Giter Club home page Giter Club logo

comment-dead-code's Introduction

Unused Code Identification and Commenting

We have automated the process of commenting out the unused class methods.

Prerequisites

  • Python >= 3.6
  • Vulture (python package)

Overview

To run this script you will need to have Python and Vulture installed on your machine. The instructions to setup Python can be found online. After installing Python, run the following command to install Vulture.

pip install vulture

Implementation

  1. Clone the repository & open the repository root directory in terminal.

  2. To comment the unused the code. Run the command with the following pattern.

    <python> <main.py> <class file path> <usage file path>
    
  3. We have a class file named class_file.py. The usage file is named usage_file.py.

  4. In usage_file.py, we are calling methods from the class_file.py which is

    • displayPublicMembers()
  5. In class_file.py, the methods which are not being used are

    • _displayProtectedMembers()
    • accessPrivateMembers()
  6. Open a terminal and run the following command to see the script in action:

    python main.py class_file.py usage_file.py
    
  7. The above mentioned unused methods are commented and we can check the code in class_file.py.

  8. The output we get after running the above mentioned command is

    <--- Unused Methods --->
    
    1) _displayProtectedMembers
    
    2) accessPrivateMembers
    
    

comment-dead-code's People

Contributors

muhammadhamzaamir avatar muhammadateeb225 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.