mirror of https://github.com/astral-sh/ruff
Add `sqlalchemy` methods to boolean-trap exclusion list (#7874)
Closes https://github.com/astral-sh/ruff/issues/7869.
This commit is contained in:
parent
016e16254a
commit
97e944003b
|
|
@ -70,6 +70,8 @@ settings.set_enable_developer_extras(True)
|
|||
foo.is_(True)
|
||||
bar.is_not(False)
|
||||
next(iter([]), False)
|
||||
sa.func.coalesce(tbl.c.valid, False)
|
||||
|
||||
|
||||
class Registry:
|
||||
def __init__(self) -> None:
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ pub(super) fn is_allowed_func_call(name: &str) -> bool {
|
|||
| "assertNotEquals"
|
||||
| "bool"
|
||||
| "bytes"
|
||||
// | "coalesce"
|
||||
| "count"
|
||||
| "failIfEqual"
|
||||
| "failUnlessEqual"
|
||||
|
|
@ -22,12 +23,15 @@ pub(super) fn is_allowed_func_call(name: &str) -> bool {
|
|||
| "getboolean"
|
||||
| "getfloat"
|
||||
| "getint"
|
||||
| "ifnull"
|
||||
| "index"
|
||||
| "insert"
|
||||
| "int"
|
||||
| "is_"
|
||||
| "is_not"
|
||||
| "isnull"
|
||||
| "next"
|
||||
| "nvl"
|
||||
| "param"
|
||||
| "pop"
|
||||
| "remove"
|
||||
|
|
|
|||
|
|
@ -81,12 +81,12 @@ FBT.py:19:5: FBT001 Boolean-typed positional argument in function definition
|
|||
21 | kwonly_nonvalued_nohint,
|
||||
|
|
||||
|
||||
FBT.py:87:19: FBT001 Boolean-typed positional argument in function definition
|
||||
FBT.py:89:19: FBT001 Boolean-typed positional argument in function definition
|
||||
|
|
||||
86 | # FBT001: Boolean positional arg in function definition
|
||||
87 | def foo(self, value: bool) -> None:
|
||||
88 | # FBT001: Boolean positional arg in function definition
|
||||
89 | def foo(self, value: bool) -> None:
|
||||
| ^^^^^ FBT001
|
||||
88 | pass
|
||||
90 | pass
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,4 +38,12 @@ FBT.py:69:38: FBT003 Boolean positional value in function call
|
|||
71 | bar.is_not(False)
|
||||
|
|
||||
|
||||
FBT.py:73:31: FBT003 Boolean positional value in function call
|
||||
|
|
||||
71 | bar.is_not(False)
|
||||
72 | next(iter([]), False)
|
||||
73 | sa.func.coalesce(tbl.c.valid, False)
|
||||
| ^^^^^ FBT003
|
||||
|
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue