Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Ruff FBT001: flake8-boolean-trap #1080

Open
Natim opened this issue May 27, 2024 · 1 comment
Open

Add support for Ruff FBT001: flake8-boolean-trap #1080

Natim opened this issue May 27, 2024 · 1 comment

Comments

@Natim
Copy link

Natim commented May 27, 2024

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.

@rbarrois
Copy link
Member

Hi,

This is a callback endpoint; changing the way we call the function requires every caller to use the same name for the same arguments.

I haven't checked whether the existing usage of those functions "in the wild" adhere to the recommended argument naming; could you look into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants