PyCQA / redbaron

Bottom-up approach to refactoring in python
http://redbaron.pycqa.org/
694 stars 74 forks source link

Function call parenthesis on a new line #159

Open jtamagnan opened 6 years ago

jtamagnan commented 6 years ago

Redbaron fails when the parenthesis for a function call start on a new line instead of on the same line as the function name. I don't think there is much of a reason to ever write code this way but I found some legacy code that made redbaron fail. I've fixed the code I ran into but though I would mention this here.

Fails:

import redbaron

test = """
def func(arg):
    return arg

output = (func
          (1))
""".strip()

test2 = """
array = [1, 2, 3]
output = (array
          [1])
"""

tree = redbaron.RedBaron(test)
tree2 = redbaron.RedBaron(test2)

Works:

import redbaron

test = """
def func(arg):
    return arg

output = (func(
          1))
""".strip()

test2 = """
array = [1, 2, 3]
output = (array[
          1])
"""

tree = redbaron.RedBaron(test)
tree2 = redbaron.RedBaron(test2)