autopep8 icon indicating copy to clipboard operation
autopep8 copied to clipboard

Inconsistent indentation of function args

Open maltekliemann opened this issue 3 years ago • 0 comments


Python Code

def function_short(first, second, third, foo, bar, baz, eggs, ham, spam) -> None:
    pass

def function_short(first, second, third, foo, bar, baz, eggs, ham, spam, some_more, even_longer, func_args) -> None:
    pass

def function_with_longer_name(first, second, third, foo, bar, baz, eggs, ham, spam) -> None:
    pass

def function_with_longer_name(first, second, third, foo, bar, baz, eggs, ham, spam, some_more, even_longer, func_args) -> None:
    pass

Running $ autopep8 --aggressive file.py yields the following result:

def function_short(first, second, third, foo, bar,
                   baz, eggs, ham, spam) -> None:
    pass

def function_short(first, second, third, foo, bar, baz, eggs,
                   ham, spam, some_more, even_longer, func_args) -> None:
    pass

def function_with_longer_name(
        first, second, third, foo, bar, baz, eggs, ham, spam) -> None:
    pass

def function_with_longer_name(first, second, third, foo, bar, baz,
                              eggs, ham, spam, some_more, even_longer, func_args) -> None:
    pass

The first three are fine (I'm assuming the difference in indentation between the first and the third is due to the length of the function name). But I would have expected the following indentation for the last one (or something similar):


def function_with_longer_name(
        first, second, third, foo, bar, baz, eggs, ham, 
        spam, some_more, even_longer, func_args) -> None:
    pass

Is this expected behavior?

Your Environment

  • Python version: 3.7.8
  • autopep8 version: autopep8 1.5.5 (pycodestyle: 2.6.0)
  • Platform: macOS 11.2.3

maltekliemann avatar Mar 29 '21 20:03 maltekliemann