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)
|
foo.is_(True)
|
||||||
bar.is_not(False)
|
bar.is_not(False)
|
||||||
next(iter([]), False)
|
next(iter([]), False)
|
||||||
|
sa.func.coalesce(tbl.c.valid, False)
|
||||||
|
|
||||||
|
|
||||||
class Registry:
|
class Registry:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ pub(super) fn is_allowed_func_call(name: &str) -> bool {
|
||||||
| "assertNotEquals"
|
| "assertNotEquals"
|
||||||
| "bool"
|
| "bool"
|
||||||
| "bytes"
|
| "bytes"
|
||||||
|
// | "coalesce"
|
||||||
| "count"
|
| "count"
|
||||||
| "failIfEqual"
|
| "failIfEqual"
|
||||||
| "failUnlessEqual"
|
| "failUnlessEqual"
|
||||||
|
|
@ -22,12 +23,15 @@ pub(super) fn is_allowed_func_call(name: &str) -> bool {
|
||||||
| "getboolean"
|
| "getboolean"
|
||||||
| "getfloat"
|
| "getfloat"
|
||||||
| "getint"
|
| "getint"
|
||||||
|
| "ifnull"
|
||||||
| "index"
|
| "index"
|
||||||
| "insert"
|
| "insert"
|
||||||
| "int"
|
| "int"
|
||||||
| "is_"
|
| "is_"
|
||||||
| "is_not"
|
| "is_not"
|
||||||
|
| "isnull"
|
||||||
| "next"
|
| "next"
|
||||||
|
| "nvl"
|
||||||
| "param"
|
| "param"
|
||||||
| "pop"
|
| "pop"
|
||||||
| "remove"
|
| "remove"
|
||||||
|
|
|
||||||
|
|
@ -81,12 +81,12 @@ FBT.py:19:5: FBT001 Boolean-typed positional argument in function definition
|
||||||
21 | kwonly_nonvalued_nohint,
|
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
|
88 | # FBT001: Boolean positional arg in function definition
|
||||||
87 | def foo(self, value: bool) -> None:
|
89 | def foo(self, value: bool) -> None:
|
||||||
| ^^^^^ FBT001
|
| ^^^^^ 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)
|
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