Skip to content

(🎁) bad-dunder-method-name config option #8732

@KotlinIsland

Description

@KotlinIsland

It would be logical that there is a configuration for bad-dunder-method-name as arbitrary libraries can 'define' them:

from pydantic import GetCoreSchemaHandler
from pydantic_core import CoreSchema


class MyClass:
    @classmethod
    def __get_pydantic_core_schema__(  # PLW3201 Bad or misspelled dunder method name `__get_pydantic_core_schema__`. (bad-dunder-name)
        cls, source_type: type[object], handler: GetCoreSchemaHandler
    ) -> CoreSchema: ...

Something like:

[tool.ruff.lint]
bad-dunder-method-name-exceptions = ["__get_pydantic_core_schema__"]

Also, the error message should reference this config option. (based mode: the LSP should offer to add it to the config)

Metadata

Metadata

Assignees

No one assigned

    Labels

    configurationRelated to settings and configuration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions