Giter VIP home page Giter VIP logo

pyref's Introduction

PyRef

Description

PyRef is a tool that automatically detect mainly method-level refactoring operations in Python projects.

Current supported refactoring operations:

  • Rename Method
  • Add Parameter
  • Remove Parameter
  • Change/Rename Parameter
  • Extract Method
  • Inline Method
  • Move Method
  • Pull Up Method
  • Push Down Method

Usage

Clone a repository from GitHub using PyRef:

python3 main.py repoClone -u "username" -r "Repo Name"

You can also use git command to clone the repository.

Extract refactorings from a given repository

python3 main.py getrefs -r "[PATH_TO_REPOSITORY]"

If you want to look into specific commit, you can use flag -c. If you want to look into specific directory, you can use flag -d.

python3 main.py getrefs -r "[PATH_TO_REPOSITORY]" -c "[CommitHash]" -d "[Directory]"

The detected refactorings will be recorded in the current folder as a json file "[project]_data.json".

Play with PyRef

You will need to first install the third-party dependencies. You can use the following command in the folder of PyRef:

pip3 install -r requirements.txt

We provide a toy project for you to test PyRef, which can be found at https://github.com/PyRef/DummyRef Please execute the following commands in order:

python3 main.py repoClone -u "PyRef" -r "DummyRef"
python3 main.py getrefs -r "Repos/DummyRef"

The detected refactorings can be found in the file "DummyRef_data.json"

Dataset for the Paper

This tool was part of the following study:

H. Atwi, B. Lin, N. Tsantalis, Y. Kashiwa, Y. Kamei, N. Ubayashi, G. Bavota and M. Lanza, "PyRef: Refactoring Detection in Python Projects," 2021 IEEE 21st International Working Conference on Source Code Analysis and Manipulation (SCAM), 2021, accepted.

The labeled oracle used in the paper can be found in the file "data/dataset.csv".

pyref's People

Contributors

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