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 coalesce/ifnull/isnull/nvl functions to the exclusion list of FBT003 (boolean positional args) #7869

Closed
balodja opened this issue Oct 9, 2023 · 0 comments · Fixed by #7874
Assignees

Comments

@balodja
Copy link

balodja commented Oct 9, 2023

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.
@balodja balodja changed the title Add coalesce/ifnull/isnull/nvl functions to the exceptions of FBT003 Add coalesce/ifnull/isnull/nvl functions to the exceptions of FBT003 (boolean positional args) Oct 9, 2023
@balodja balodja changed the title Add coalesce/ifnull/isnull/nvl functions to the exceptions of FBT003 (boolean positional args) Add coalesce/ifnull/isnull/nvl functions to the exclusion list of FBT003 (boolean positional args) Oct 9, 2023
@charliermarsh charliermarsh self-assigned this Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants