Open perrinjerome opened 1 year ago
With this code:
funccall( a='1', b='2', c='3', )
and running this codmod:
$ bowler do 'Query(".").select_function("funccall").modify_argument("a", "aa")' --- ./bug.py +++ ./bug.py @@ -1,6 +1,6 @@ funccall( - a='1', + aa='1', b='2', - c='3', + c='3' )
the trailing comma on c=3, is not kept. I would expect that it is kept.
c=3,
If we agree that would be the expected behavior and that you are willing to review a pull request I can try to take a look.
I think this happens around here: https://github.com/facebookincubator/Bowler/blob/92c9eeb7eebab8a1b65a989d0cf3b4947773ea2b/bowler/imr.py#L238
and that this code could be changed to check if self.capture['function_arguments'][0].children[-1] is a comma and add it to arguments if that's the case.
self.capture['function_arguments'][0].children[-1]
arguments
Thanks !
@perrinjerome can you assign this to me?
@pioneerHitesh I cannot, I think only people with write access can do this
With this code:
and running this codmod:
the trailing comma on
c=3,
is not kept. I would expect that it is kept.If we agree that would be the expected behavior and that you are willing to review a pull request I can try to take a look.
I think this happens around here: https://github.com/facebookincubator/Bowler/blob/92c9eeb7eebab8a1b65a989d0cf3b4947773ea2b/bowler/imr.py#L238
and that this code could be changed to check if
self.capture['function_arguments'][0].children[-1]
is a comma and add it toarguments
if that's the case.Thanks !