-
Notifications
You must be signed in to change notification settings - Fork 61
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
RemoveExtraSemicolons removes newline if semicolon is in front of statement #100
RemoveExtraSemicolons removes newline if semicolon is in front of statement #100
Conversation
Add test with @ExpectedToFail
Thanks for adding the replicating test already! I expect the fix is not far off either; likely prepend the prefix from the semicolon to the statement following the semicolon, if both are on the same line(?). Not expected of you to immediately fix that; but thought to note it here for when the pipeline succeeds to briefly explore before a merge. |
Remove empties on block level but keep prefix for next statements.
Something like this? 🤔 |
int a = 1; //first we set a to 1 | ||
;a = 2;//then we set a to 2 | ||
a = 3;//then we set a to 3 | ||
;a = 4;;;;;//then we set a to 4 | ||
;a = 5;//then we set a to 5 | ||
a = 6;;//then we set a to 6 | ||
if (a == 6) { //if a is 6 | ||
;a = 7;;//then if a is 6 we set a to 7 | ||
} | ||
;; | ||
;//next we set a to 8 | ||
;a = 8; | ||
return a; | ||
; | ||
//we are done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add in block comments /* foo; */
just to be sure,
but otherwise I really like the variations you've applied here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
…_semicolons_removes_newline
Just merged main into this branch; we're still dependent on two branches in other repositories: |
…_semicolons_removes_newline
src/main/java/org/openrewrite/staticanalysis/RemoveExtraSemicolons.java
Outdated
Show resolved
Hide resolved
Glad to see everything passing now that 8.0 has been merged! Didn't expect anything else, but still nice to see. Would you have time for a review @joanvr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good! Thanks for the fix and new tests! Just a minor unused import in the tests.
src/test/java/org/openrewrite/staticanalysis/RemoveExtraSemicolonsTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Joan Viladrosa <joan@moderne.io>
Add test with @ExpectedToFail
#99