FactoryBoy / factory_boy

A test fixtures replacement for Python

Home Page:https://factoryboy.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for Ruff `FBT001`: `flake8-boolean-trap`

Natim opened this issue · comments

The problem

Please use named parameter in the save method so that we can activate

return self.function(
instance, create, context.value, **context.extra)

Proposed solution

        return self.function(
            instance, create=create, extracted=context.value, **context.extra)

Extra notes

Checks for the use of boolean positional arguments in function definitions, as determined by the presence of a bool type hint.

Calling a function with boolean positional arguments is confusing as the meaning of the boolean value is not clear to the caller and to future readers of the code.

The use of a boolean will also limit the function to only two possible behaviors, which makes the function difficult to extend in the future.