Skip to content

Improve diagnostics for class definitions that don't provide required arguments to superclass __init_subclass__ methods #2482

@AlexWaygood

Description

@AlexWaygood

I wish we could make the diagnostics here a bit friendlier. Some users may not be aware of how the semantics of __init_subclass__ work, and the diagnostic doesn't try to explain it much at the moment:


image

But propagating context into (or out of) binding.report_diagnostics() in order to add subdiagnostics looks really complicated ☹️. So that's probably better done as a followup

Originally posted by @AlexWaygood in astral-sh/ruff#22185 (review)

Metadata

Metadata

Assignees

No one assigned

    Labels

    diagnosticsRelated to reporting of diagnostics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions