Skip to content
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

Automation Script: find_moved_or_renamed_commit #1559

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Derrick2000
Copy link
Contributor

@Derrick2000 Derrick2000 commented Dec 3, 2024

Inspired by PR

Test:

https://github.com/TooTallNate/Java-WebSocket,fa3909c391195178ccf5a92d4ac342a30ae247c8,.,org.java_websocket.issues.Issue580Test.runNoCloseBlockingTestScenario0,NDOD;NOD,,,

Execution:

./find_moved_or_renamed_commit.sh runNoCloseBlockingTestScenario0 src/test/java/org/java_websocket/issues/Issue580Test.java fa3909c391195178ccf5a92d4ac342a30ae247c8

Output:

commit 2ce6e6149d0ef44f4919e75326265c64c144a00f
Author: marci4 <[email protected]>
Date:   Thu Nov 8 19:41:32 2018 +0100

    Uses parameters

M       src/test/java/org/java_websocket/issues/Issue580Test.java

The commit found matches the one I claimed at https://github.com/TestingResearchIllinois/idoft/pull/1545/files#diff-14b36ce14fbe73777d285f08d4d8e6a403228c1d401013c1a0c57b867ef99a41R6755

@darko-marinov
Copy link
Contributor

@ljmcr can you review this (on Thursday, no rush!).

--reverse \
--color \
--decorate \
-- "$FILENAME" | less -R
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script is not automatically quit after showing the output. Maybe try -- "$FILENAME" | cat instead of less -R , or directly output the console to an outputfile

@ljmcr
Copy link
Contributor

ljmcr commented Dec 5, 2024

Overall, the script looks good to me, and I’ve successfully used it to verify my findings in apache/dubbo. The commits reported by the script matched my findings using the "auto-check-moved-or-rename".
I believe there are a few areas where the script can be improved:
1.Currently, the script processes only one test at a time, and I need to manually copy and paste the file path and method name each time I run it. It would be more efficient if the script could automatically read input from a file and handle multiple tests in a single execution.
2. In some cases I analyzed in apache/dubbo, the script flagged a test method as renamed at a specific commit. However, after I checking the commit, I found that the method wasn’t renamed but only the modifier was changed (e.g., public void testInvoke() was changed to void testInvoke()). Maybe Professor Darko @darko-marinov can help to clarify if such cases should be categorized as "MovedOrRenamed." If not, it may need to add more advanced logic to filter out such cases.

@darko-marinov
Copy link
Contributor

@Derrick2000 can you start addressing point 1?

@ljmcr for point 2, the change may have been related to JUnit 4 vs. JUnit 5. Do you know if the test method still ran after it was not marked public?

@ljmcr
Copy link
Contributor

ljmcr commented Dec 6, 2024

@Derrick2000 can you start addressing point 1?

@ljmcr for point 2, the change may have been related to JUnit 4 vs. JUnit 5. Do you know if the test method still ran after it was not marked public?

I have tried and the test is still working after not marked as public. And based on the description of the commit, the change of modifier do relate to the switch Junit4 to Junit5 https://sonarcloud.io/organizations/apache/rules?open=java%3AS5786&rule_key=java%3AS5786

@darko-marinov
Copy link
Contributor

@Derrick2000 do you want to look into point 1, or should I accept this only partially?

@Derrick2000
Copy link
Contributor Author

@Derrick2000 do you want to look into point 1, or should I accept this only partially?

I've created a new script to handle batch inputs from a file

File Example: batch_input.txt

myFunction src/MyClass.php a1b2c3d4
anotherFunction src/AnotherClass.php d4c3b2a1
yetAnotherFunction src/Service.php HEAD

@ljmcr could you review and test the find_moved_or_renamed_commit_batch script to see if it works as expected? If everything looks good, I'll update the README with detailed instructions. Thanks

@ljmcr
Copy link
Contributor

ljmcr commented Dec 11, 2024

@Derrick2000 do you want to look into point 1, or should I accept this only partially?

I've created a new script to handle batch inputs from a file

File Example: batch_input.txt

myFunction src/MyClass.php a1b2c3d4 anotherFunction src/AnotherClass.php d4c3b2a1 yetAnotherFunction src/Service.php HEAD

@ljmcr could you review and test the find_moved_or_renamed_commit_batch script to see if it works as expected? If everything looks good, I'll update the README with detailed instructions. Thanks

LGTM

@darko-marinov
Copy link
Contributor

Thank you, @ljmcr . @Derrick2000 please update readme to match, and I can accept.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants