Skip to content

FBT003: Ignore by default django.db.models.Value #10356

@9128305

Description

@9128305

Hi, there is a common usage of Value(False) | Value(True) in Django projects. Ruff does not provide any configuration to extend the FBT003 default whitelist. So my request would be 1) Ignore Value by default like #6711 2) settings to extend FBT003 whitelist.

from django.db.models import Case, Q, Value, When
...
qs.annotate(
    is_foo_or_bar=Case(
        When(Q(is_foo=True) | Q(is_bar=True)),
        then=Value(True),  # noqa: FBT003
    ),
    default=Value(False),  # noqa: FBT003
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    configurationRelated to settings and configurationruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions