-
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
Add method parameters alignment, fixes to spaces visitor, and extended end2end tests #132
Conversation
def_idx = source.index("def") | ||
async_idx = source.find("async") | ||
start_idx = async_idx if async_idx != -1 and async_idx < def_idx else def_idx |
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 am a little bit worried that this could go wrong if there is a decorator or comment including the substring def
or async
somewhere. It would be safer if we in this FirstArgPrinter
would detect when either of these keywords is written and store that in a variable.
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 am also wondering if this works correctly when for example a decorator is on the same line as the def
keyword as in:
@decorator def my_function(a,
b):
pass
I suppose this would be easy to test.
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.
That is not valid Python (as far as I know)
return self if align_multiline_parameters is self._align_multiline_parameters else replace(self, | ||
_align_multiline_parameters=align_multiline_parameters) | ||
|
||
_method_declaration_parameters: MethodDeclarationParameters |
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.
We need to make the same modification to the Java side, where we declare this style.
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.
Added
What's changed?
This PR adds alignment for method parameters and implements several fixes in the visitor of the space, particularly for imports, and extends the overall test-suite.
What's your motivation?
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
@knutwannheden
Have you considered any alternatives or workarounds?
Any additional context
Checklist