Skip to content

RUF013 undocumented limitation x: CustomClass = None is not caught #14018

@jond01

Description

@jond01

It seems like the following should be caught or at least be added to the documented limitations:

from enum import Enum
from typing import Optional


class Letter(Enum):
    """ok."""

    A = "A"


class CatchMe:
    """class."""


def f(
    letter: Letter = None,  # <--- should be caught
    word: Optional[str] = None,
    catch: CatchMe = None,  # <--- should be caught
) -> None:
    """Doc."""
  • List of keywords you searched for before creating this issue: RUF013
  • A minimal code snippet that reproduces the bug: https://play.ruff.rs/afaf262e-0615-4732-83aa-4cc32af930c2
  • The command you invoked: ruff check file.py --select RUF013
  • The current Ruff settings: in the snippet.
  • The current Ruff version: 0.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationpreviewRelated to preview mode featuresruleImplementing or modifying a lint ruletype-inferenceRequires more advanced type inference.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions