Skip to content

Support respect-type-ignore-comments in file overrides #2530

@strokirk

Description

@strokirk

Hello!

#1422 and astral-sh/ruff#22137, which added respect-type-ignore-comments as a global configuration option, have been very useful for me to avoid warnings in ty where it doesn't agree with mypy. I'd love if that could be applied on a file-by-file basis using overrides.

A common example is Pydantic's @computed_field decorator, which requires # type: ignore[prop-decorator] for mypy but doesn't need any ignore comment for ty.

Since a lot of those models are usually defined in a single file, or file matching a common pattern, an override would be super useful.

Example

from pydantic import BaseModel, computed_field

class MyModel(BaseModel):
    @computed_field  # type: ignore[prop-decorator]
    @property
    def my_prop(self) -> dict:
        ...

Thanks for a great tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    configurationRelated to settings and configurationsuppressionRelated to supression of violations e.g. ty:ignore

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions