-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix FBT001 Boolean-typed positional argument in function definition #1765
Conversation
@danlamanna FYI, I thought you'd dislike this, but I actually realize it's a typically a good practice to encourage boolean arguments to be keyword-only. |
fd1e0c0
to
b38b588
Compare
@@ -5,7 +5,7 @@ | |||
|
|||
|
|||
def _normalize_version_metadata( | |||
raw_version_metadata: dict, embargo: bool, name: str, email: str | |||
raw_version_metadata: dict, embargo: bool, name: str, email: str # noqa: FBT001 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why exclude this one? Because these arguments (including embargo
) constitute a uniform and required description of the data to be normalized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@waxlamp Good point. I was just being conservative. Changing this would either require making multiple other arguments keyword-only or changing the order of the arguments. It's an internal API, so it wouldn't break anything to change it, however.
Now they you mentioned it, I'm inclined to change this one too, particularly to have another example of the "right" (really just "safer") way to have boolean arguments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
This explicitly expects Django signals and Click options to be called with keyword arguments.
b38b588
to
e970122
Compare
I agree with this. I think scrutinizing any usage of boolean function arguments is a good thing, and requiring boolean args to be keyword-only is a good middle-ground. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
🚀 PR was released in |
This explicitly expects Django signals and Click options to be called with keyword arguments.