Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve PGH003 to require codes for # pyright: ignore #3935

Closed
bryanforbes opened this issue Apr 11, 2023 · 2 comments · Fixed by #3941
Closed

Improve PGH003 to require codes for # pyright: ignore #3935

bryanforbes opened this issue Apr 11, 2023 · 2 comments · Fixed by #3941
Labels
good first issue Good for newcomers rule Implementing or modifying a lint rule

Comments

@bryanforbes
Copy link

Ruff version: 0.0.261

Given the following configuration:

[tool.pyright]
typeCheckingMode = "strict"

[tool.ruff]
select = ["PGH003"]

And the following file test.py:

from __future__ import annotations


class One:
    def do_something(self, a: int) -> None:
        ...


class Two(One):
    def do_something(self, a: str) -> None:  # pyright: ignore
        ...

No error is generated for line 10. It would be nice if PGH003 checked for # pyright: ignore without codes.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Apr 11, 2023
@charliermarsh
Copy link
Member

Agreed.

@Avasam
Copy link
Contributor

Avasam commented Apr 12, 2023

+1
Note that not all Pyright issues have an associated code, but I've only landed on such valid use-cases in some very rare stub-only edge cases. (like making a protocol from non-protocol bases, there's a couple examples in typeshed)
At that point you could do # pyright: ignore # noqa: PGH003

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants