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

Fix FBT001 Boolean-typed positional argument in function definition #1765

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

brianhelba
Copy link
Collaborator

This explicitly expects Django signals and Click options to be called with keyword arguments.

@brianhelba
Copy link
Collaborator Author

@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.

@@ -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
Copy link
Member

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?

Copy link
Collaborator Author

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.

Copy link
Collaborator Author

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.
@mvandenburgh
Copy link
Member

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.

Copy link
Member

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@brianhelba brianhelba merged commit 7b6f0f6 into master Dec 6, 2023
10 checks passed
@brianhelba brianhelba deleted the boolean-arg branch December 6, 2023 20:06
@dandibot
Copy link
Member

🚀 PR was released in v0.3.67 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants