Skip to content

Function arguments in multiple lines. #17

@cossio

Description

@cossio
# Yes 
function my_large_function(argument1, argument2,
                           argument3, argument4,
                           argument5, x, y, z)

# No
function my_large_function(argument1, 
                           argument2,
                           argument3, 
                           argument4,
                           argument5,
                           x,
                           y,
                           z)

Any reason not to prefer the Blue style advice here:

function my_large_function(
    argument1, argument2,
    argument3, argument4,
    argument5, x, y, z
)
    # code
end

Notably, when there are many arguments in multiple lines, no argument is placed on the same line as the function name.
All arguments are at the same, one-level, indentation, so there is no custom indentation here and there are no alignment issues if, say, the function name changes.
Also, the closing parenthesis is alone in its own line, making very clear when the argument list stops and the code begins.
However it'd be fine that not every argument is on its own line (as enforced by Blue, but relaxed here).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions