arguments-out-of-order / W1114ΒΆ

Message emitted:

Positional arguments appear to be out of order

Description:

Emitted when the caller's argument names fully match the parameter names in the function signature but do not have the same order.

Problematic code:

def function_3_args(first_argument, second_argument, third_argument):
    """Three arguments function"""
    return first_argument, second_argument, third_argument


def args_out_of_order():
    first_argument = 1
    second_argument = 2
    third_argument = 3

    function_3_args(  # [arguments-out-of-order]
        first_argument, third_argument, second_argument
    )

Correct code:

def function_3_args(first_argument, second_argument, third_argument):
    """Three arguments function"""
    return first_argument, second_argument, third_argument


def args_out_of_order():
    first_argument = 1
    second_argument = 2
    third_argument = 3

    function_3_args(first_argument, second_argument, third_argument)

Created by the typecheck checker.