This is the repository for Micro-change Miner.
- git-stein: Convert Git repository to method-level
$ git clone https://github.com/sh5i/git-stein.git
$ cd git-stein
$ ./gradlew executableJar
- RefactoringMiner: The state of the art refactoring mining tool
- We extend the RefactoringMiner3.0.4 by considering the refactoring affected elements' locations
- gradle
$ brew install gradle
$ git clone git@github.com:MashiroCl/MicroChangeMiner.git
$ cd MicroChangeMiner
$ ./gradlew shadowJar
$ java -jar <git-stein_path/build/libs/git-stein.jar> <target_repo_path> -o <output_repo_path> @historage-jdt --no-original --no-classes --no-fields --parsable --mapping
Obtain a map from a method-level repository whose key is the original repository sha1, value is the corresponding method-level repository sha1, i.e. <original_sha1:method-level_sha1>
$ java -jar build/libs/miner-1.0-SNAPSHOT-all.jar commitMap <repo_path/.git> -o <output_jsonfile.json>
$ java -jar <RefactoringMiner_path/build/libs/miner-1.0-SNAPSHOT-all.jar> refmine <original_repo_path> <output_path> >./runLog/<repo_name>_rm.log
$ java -jar build/libs/miner-1.0-SNAPSHOT-all.jar mine <method_level_repo_path> <output_json_path.json> --csv <output_csv_path.csv> --map <commit_map_path> --refactoring <mined_refactoring_directory> --original <original_repo_path/.git> --notCoveredPath <output_path_for_uncovered> >runLog/<repo_name>.log
e.g. for repository mbassador
$ java -jar build/libs/miner-1.0-SNAPSHOT-all.jar mine ./method_level/mbassador/.git ./mined/mbassador.json --csv ./mined/mbassador.csv --map ./commitMap/mbassador.json --refactoring ./minedRefactoring/mbassador --original ./OSS/mbassador/.git --notCoveredPath ./notCovered/mbassador.json >runLog/mbassador.log
public class YourMicroChange implements MicroChangePattern{
@Override
public boolean matchConditionGumTree(Action action, Map<Tree, Tree> mappings) {
// Implement the match strategy here
// if you need the actions for all, implement the same name method below
return false;
}
@Override
public boolean matchConditionGumTree(Action action, Map<Tree, Tree> mappings, Map<Tree, List<Action>> nodeActions) {
// Implement the match strategy here
return false;
}
@Override
public SrcDstRange getSrcDstRange(Action action, Map<Tree, Tree> mappings, Map<Tree, List<Action>> nodeActions, EditScriptStorer editScriptStorer) {
// get the line range of this micro-change
SrcDstRange srcDstRange = new SrcDstRange();
// left side range
// right side range
return srcDstRange;
}
}
2. Declare your own micro-change if you want it to be mined in org.mashirocl.command.MineCommand#loadMicroChanges()
public static void loadMicroChanges(PatternMatcher patternMatcherGumTree) {
patternMatcherGumTree.addMicroChange(new AddConjunctOrDisjunct());
...
patternMatcherGumTree.addMicroChange(new YourMicroChange());
}
You can refer to the complete catalog of micro-change in Catalog.
(Formal doi to be added)
The following article includes the details of the micro-changes and the miner. We encourage contributions to the micro-changes or the miner.
Lei Chen, Michele Lanza, Shinpei Hayashi: ''Understanding Code Change with Micro-Changes''. In Proceedings of the 40th IEEE International Conference on Software Maintenance and Evolution (ICSME 2024). Flagstaff, AZ, USA, oct, 2024.
@article{chen2024understanding,
title={Understanding Code Change with Micro-Changes},
author={Chen, Lei and Lanza, Michele and Hayashi, Shinpei},
journal={arXiv preprint arXiv:2409.09923},
year={2024}
}
}