Skip to content

sklego/log-step-extra-bare

Rule log-step-extra-bare
Pack scikit-lego
Severity error
Fix none, edit by hand
Library versions every version

A bare @log_step_extra takes the decorated function as a log function, so calling the function returns another function and not a frame. Pass the log functions, as in @log_step_extra(len).

@log_step_extra
@log_step_extra(len)
def add_total(frame):
return frame.assign(total=frame["price"] * frame["count"])

The rule reports @log_step_extra without arguments, as a bare decorator or with empty parentheses. log_step works both ways, but log_step_extra takes the log functions as its arguments. As a bare decorator it takes the decorated function as a log function.

xpd has no automatic fix, so make the change by hand.

Form Result
@log_step_extra Calling the function returned another function, not a frame, and raised nothing.
@log_step_extra() ValueError "Supply at least one log_function for log_step_extra"

xpd prints this message with the issue. A name that starts with $ stands for code from your file.

A bare @log_step_extra takes the decorated function as a log function, so calling the function returned another function, not a frame. Pass the log functions, as in @log_step_extra(len).

Browse the other rules of the scikit-lego pack.