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 is_ and is_not to excluded functions for FBT003 #6307

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def used(do):
os.set_blocking(0, False)
g_action.set_enabled(True)
settings.set_enable_developer_extras(True)

foo.is_(True)
bar.is_not(False)

class Registry:
def __init__(self) -> None:
Expand Down
2 changes: 2 additions & 0 deletions crates/ruff/src/rules/flake8_boolean_trap/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub(super) fn is_allowed_func_call(name: &str) -> bool {
| "index"
| "insert"
| "int"
| "is_"
| "is_not"
| "param"
| "pop"
| "remove"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ FBT.py:19:5: FBT001 Boolean positional arg in function definition
21 | kwonly_nonvalued_nohint,
|

FBT.py:85:19: FBT001 Boolean positional arg in function definition
FBT.py:86:19: FBT001 Boolean positional arg in function definition
|
84 | # FBT001: Boolean positional arg in function definition
85 | def foo(self, value: bool) -> None:
85 | # FBT001: Boolean positional arg in function definition
86 | def foo(self, value: bool) -> None:
| ^^^^^^^^^^^ FBT001
86 | pass
87 | pass
|


Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ FBT.py:69:38: FBT003 Boolean positional value in function call
68 | g_action.set_enabled(True)
69 | settings.set_enable_developer_extras(True)
| ^^^^ FBT003
70 | foo.is_(True)
71 | bar.is_not(False)
|