ruff/crates/ruff_python_semantic/src
Victor Hugo Gomes c0dbcb3434
[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.
2023-07-26 22:56:15 +00:00
..
analyze Remove parser dependency from ruff-python-ast (#6096) 2023-07-26 17:47:22 +02:00
binding.rs [flake8-pyi] Implement PYI018 (#6018) 2023-07-26 22:56:15 +00:00
context.rs Remove separate ReferenceContext enum (#4631) 2023-05-24 15:12:38 +00:00
definition.rs Remove parser dependency from ruff-python-ast (#6096) 2023-07-26 17:47:22 +02:00
globals.rs Remove parser dependency from ruff-python-ast (#6096) 2023-07-26 17:47:22 +02:00
lib.rs Move StarImport to its own module (#5186) 2023-06-20 13:12:46 -04:00
model.rs Add comment regarding class scope short circuit (#6101) 2023-07-26 14:55:05 -05:00
node.rs Remove parser dependency from ruff-python-ast (#6096) 2023-07-26 17:47:22 +02:00
reference.rs Remove parser dependency from ruff-python-ast (#6096) 2023-07-26 17:47:22 +02:00
scope.rs Replace NoHashHasher usages with FxHashMap (#6049) 2023-07-24 23:41:57 +00:00
star_import.rs Move StarImport to its own module (#5186) 2023-06-20 13:12:46 -04:00