mirror of
https://github.com/astral-sh/ruff.git
synced 2025-12-23 09:19:39 +00:00
[flake8-pyi] Implement PYI018 (#6018)
## Summary
Check for unused private `TypeVar`. See [original
implementation](2a86db8271/pyi.py (L1958)).
```
$ flake8 --select Y018 crates/ruff/resources/test/fixtures/flake8_pyi/PYI018.pyi
crates/ruff/resources/test/fixtures/flake8_pyi/PYI018.pyi:4:1: Y018 TypeVar "_T" is not used
crates/ruff/resources/test/fixtures/flake8_pyi/PYI018.pyi:5:1: Y018 TypeVar "_P" is not used
```
```
$ ./target/debug/ruff --select PYI018 crates/ruff/resources/test/fixtures/flake8_pyi/PYI018.pyi --no-cache
crates/ruff/resources/test/fixtures/flake8_pyi/PYI018.pyi:4:1: PYI018 TypeVar `_T` is never used
crates/ruff/resources/test/fixtures/flake8_pyi/PYI018.pyi:5:1: PYI018 TypeVar `_P` is never used
Found 2 errors.
```
In the file `unused_private_type_declaration.rs`, I'm planning to add
other rules that are similar to `PYI018` like the `PYI046`, `PYI047` and
`PYI049`.
ref #848
## Test Plan
Snapshots and manual runs of flake8.
This commit is contained in:
parent
788643f718
commit
c0dbcb3434
12 changed files with 149 additions and 0 deletions
1
ruff.schema.json
generated
1
ruff.schema.json
generated
|
|
@ -2367,6 +2367,7 @@
|
|||
"PYI015",
|
||||
"PYI016",
|
||||
"PYI017",
|
||||
"PYI018",
|
||||
"PYI02",
|
||||
"PYI020",
|
||||
"PYI021",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue