MORCoRA is search-based refactoring tool for recommending refactoring operations towards a target repository snapshot.
It based on multi-objective evolutionary algorithm (MOEA), the refactorings recommended achieve 3 objectives:
- Improving code quality
- Preserving semantic coherence
- Preserving high review availability
python 3.8 and later
- Clone this repository and install dependencies
$ git clone https://github.com/MashiroCl/MORCOpy
$ cd MORCOpy
$ pip install -r requirements.txt
note: you can find jmetalpy here, download the jmetal 1.5.7 package, and use pip to install it.
- Creating a personal access token
MORCoRA uses the GitHub API, it needs the personal access token to extract pull requests.
For how to get personal access token, please refer to here
- Set the token as a environment variable
After you get the token, set it as an environment variable, and named the variable as MORCORE
For MacOS:
$ echo "export MORCORE=<personal-access-token>" >> ~/.bash_profile
$ source ~/.bash_profile
For Linux:
export MORCORE=<personal-access-token>
- Extract abstract representation and call graph for the target repository snapshot.
Required: <repo_path>: cloned repository path <repo_url>: GitHub url for the repository
$ python3 command.py -r <repo_path> -u <repo_url> -m extract
The extracted data are stored in <repo_path>/MORCoRE/
-
Fill in
config.txtwith the parent directory of the target repository, e.g.<repo_path>=/A/B/C/repo_name, fill theconfig.txtwith/A/B/C/ -
Search refactoring sequences
$ python3 command.py -n <repo_name> -i <max_evaluation_number> -p customize -m search_customize
The following article include the details of MORCoRA.
Lei Chen, Shinpei Hayashi. MORCoRA: Multi-Objective Refactoring Recommendation Considering Review Availability.International Journal of Software Engineering and Knowledge Engineering, vol. 34, no. 12, pp. 1919-1947. dec, 2024.
@article{
author = {Chen, Lei and Hayashi, Shinpei},
title = {MORCoRA: Multi-Objective Refactoring Recommendation Considering Review Availability},
journal = {International Journal of Software Engineering and Knowledge Engineering},
volume = {34},
number = {12},
pages = {1919-1947},
year = {2024},
}