-
Notifications
You must be signed in to change notification settings - Fork 5
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
Autoformat/spacevisitor #96
Conversation
f80f344
to
5af2396
Compare
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.
Nice!
Let's merge this and fix any remaining issues in follow-up commits. From what I saw we need some tests for trailing comma syntax and we also need to make sure to always use list_map()
rather than list comprehensions when updating the LST model.
from rewrite.test import rewrite_run, python, RecipeSpec, from_visitor | ||
|
||
|
||
def test_spaces_within_dict_declaration(): |
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.
Can we add one more test for the within.braces
style? The visitor implements formatting for this, but I don't see any actual test for it.
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.
I also believe that the formatting style for within.braces
probably should also apply to sets, set comprehensions, and dictionary comprehensions. These cases are probably not covered yet by the formatter. Similarly, the within.brackets
should also apply to list comprehensions.
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.
One more case which we should at least have tests for (didn't check if the visitor already covers it or not) is type hints, so that we can check that witin.brackets
correctly formats type hints like Union[str, int]
.
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.
Some suggestions could not be made:
- rewrite-python-remote/src/main/java/org/openrewrite/python/remote/Extensions.java
- lines 18-20
- lines 33-32
- rewrite-python-remote/src/main/java/org/openrewrite/python/remote/PythonReceiver.java
- lines 31-34
- lines 2508-2511
- rewrite-python-remote/src/main/java/org/openrewrite/python/remote/PythonSender.java
- lines 29-31
- lines 1187-1190
- rewrite-python-remote/src/main/java/org/openrewrite/python/remote/PythonValidator.java
- lines 26-30
- rewrite-python/src/main/java/org/openrewrite/python/tree/Py.java
- lines 375-374
- rewrite-python/src/test/java/org/openrewrite/python/tree/CollectionTest.java
- lines 40-40
6b64598
to
41e2bac
Compare
What's changed?
Added progress on space visitor. Based on
What's your motivation?
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Checklist