Skip to content

Add coalesce/ifnull/isnull/nvl functions to the exclusion list of FBT003 (boolean positional args) #7869

@balodja

Description

@balodja

Those functions are sqlalchemy counterparts of commonly used sql functions. Typical uses include using booleans in positional arguments as default values. So I suggest to add them to the exclusion list of boolean positional arguments rule.

Just like it was done for is_ and is_not before: #6307

Example:

import sqlalchemy as sa

tbl = sa.Table(
    "mytable",
    sa.Column("id", sa.Integer, primary_key=True),
    sa.Column("valid", sa.Bool, nullable=True),
)

is_valid = sa.func.coalesce(tbl.c.valid, False)

Output:

> ruff check test.py 
test.py:9:42: FBT003 Boolean positional value in function call
Found 1 error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions