-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Purity Logic #3
Comments
Hello, In order to use PurityChecker, there is a file named API.java. (src/purity/API.java) Within the main method of the API class, you will pass the commit link, and you will get the pcr object from the isPureAPI method. I have used detectModelDiff and overridden the processModelDiff method. The pcr map returns all the refactorings in the commit as its keys, along with a PurityCheckResult object as its values. The value might be null in cases where we do not support the specific refactoring type purity. Just do not forget to uncomment some lines in the PurityChecker.java (src/purity/PurityChecker.java) file, so that you can analyze the purity of a specific refactoring type. For example, if you need to review the purity of an Extract Method refactoring, uncomment the line 47 in the PurityChecker.java file. I commented them because of the testing purposes. Sorry for the inconvenience. If you need further assistant setting up the tool, please let me know. |
Hi,
Thank you for your answers. |
That is a very interesting topic. About your questions: 1- Yes. We defined a pure refactoring is the one that does not include any modifications that alter the behavior of the refactored code. It supports changes stemming from specific refactoring type mechanics, overlapping refactoring, etc. In other words, compare to a Root-canal refactoring, we allow a broader range of changes to consider a refactoring as behavior-preserving. 2- PurityChecker only supports method-level refactoring. Extract Method, Extract and Move Method, Inline Method, Move and Inline Method, Move Method, Move and Rename Method, Pull Up Method, and Push Down Method. The reason behind this is that the concept of purity can be well-defined for a refactoring that has a body. We figured that determining purity rules for refactorings that do not have a body would not be beneficial in our research, as in almost all the cases, an Extract Class refactoring for instance, would follow numerous changes within its scope. Moreover, statement mappings and replacements (bodyMapper) provided from RefactoringMiner, are reported only for method-level refactorings. So, as PurityChecker analyzes these resources for decision-making, we could not extend our tool to support other refactoring types. We have identified that extending PurityChecker to support other refactoring types can be one of our future works, which can be conducted in future researches. Let me know if you need further clarification on the tool. |
Hi, Thank you for your answers. |
Hello, Currently, neither RefactoringMiner nor PurityChecker do not have this feature to indicate whether a specific commit has only refactoring-related changes. It shouldn't be a super complex feature, but it's more related to the RefactoringMiner (main tool), not PurityChecker. |
Hi,
I need to check if a class with refactoring has only refactoring, so I asked this question and Mr.Tsantalis directed me to your fork of refactoring-miner. I investigated test cases a little bit but couldn't get quite sure about usage. Normally I use miner.detectAll method and implement public void handle(String commitId, List refactorings) method. So I was expecting something like Refactoring dto object will have boolean isPure attribute.
But from the test cases only method i see is detectModelDiff which takes commit id as argument and I need to implement processModelDiff to visit the umlmodeldiffs and i should call below statement:
Map<Refactoring, PurityCheckResult> pcr = PurityChecker.isPure(umlModelDiff);
does this pcr map returns all the refactorings or it expects this commit to has only refactoring?
I am not quite sure if it is possible but I was expecting refactorings related class has only refactorings so that I can filter out other code changes which might affect software metrics...
The text was updated successfully, but these errors were encountered: