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

modify_argument loses the trailing , in call arguments #147

Open
perrinjerome opened this issue Apr 28, 2023 · 2 comments
Open

modify_argument loses the trailing , in call arguments #147

perrinjerome opened this issue Apr 28, 2023 · 2 comments

Comments

@perrinjerome
Copy link

perrinjerome commented Apr 28, 2023

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.

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:

parameters.insert_child(1, arguments)

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.

Thanks !

@pioneerHitesh
Copy link

@perrinjerome can you assign this to me?

@perrinjerome
Copy link
Author

@pioneerHitesh I cannot, I think only people with write access can do this

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

No branches or pull requests

2 participants