ruff/crates
Tom Kuson 2b03bd18f4
Implement Pylint consider-using-in (#5193)
## Summary

Implement Pylint rule [`consider-using-in`
(`R1714`)](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-in.html)
as `repeated-equality-comparison-target` (`PLR1714`). This rule checks
for expressions that can be re-written as a membership test for better
readability and performance.

For example,

```python
foo == "bar" or foo == "baz" or foo == "qux"
```

should be rewritten as

```python
foo in {"bar", "baz", "qux"}
```

Related to #970. Includes documentation.

### Implementation quirks

The implementation does not work with Yoda conditions (e.g., `"a" ==
foo` instead of `foo == "a"`). The Pylint version does. I couldn't find
a way of supporting Yoda-style conditions without it being inefficient,
so didn't (I don't think people write Yoda conditions any way).

## Test Plan

Added fixture.

`cargo test`
2023-07-13 01:32:34 +00:00
..
flake8_to_ruff Bump version to 0.0.278 (#5714) 2023-07-12 12:39:56 -04:00
ruff Implement Pylint consider-using-in (#5193) 2023-07-13 01:32:34 +00:00
ruff_benchmark Create PyFormatOptions 2023-06-26 14:02:17 +02:00
ruff_cache Only use a single cache file per Python package (#5117) 2023-06-19 17:46:13 +02:00
ruff_cli Bump version to 0.0.278 (#5714) 2023-07-12 12:39:56 -04:00
ruff_dev Document ruff_dev and format_dev (#5648) 2023-07-12 16:18:22 +02:00
ruff_diagnostics Run nightly Clippy over the Ruff repo (#5670) 2023-07-10 23:44:38 -04:00
ruff_formatter Remove mode from BestFitting 2023-07-11 14:19:26 +02:00
ruff_index Add unreachable code rule (#5384) 2023-07-04 14:27:23 +00:00
ruff_macros Run nightly Clippy over the Ruff repo (#5670) 2023-07-10 23:44:38 -04:00
ruff_python_ast Use shared Cursor across crates (#5715) 2023-07-12 21:09:27 +00:00
ruff_python_formatter Use shared Cursor across crates (#5715) 2023-07-12 21:09:27 +00:00
ruff_python_resolver Fix CI by downgrading to cargo insta 1.29.0 (#5589) 2023-07-08 14:54:49 +00:00
ruff_python_semantic Differentiate between runtime and typing-time annotations (#5575) 2023-07-07 00:21:44 -04:00
ruff_python_stdlib Remove some additional manual iterator matches (#5482) 2023-07-03 16:29:59 +00:00
ruff_python_whitespace Use shared Cursor across crates (#5715) 2023-07-12 21:09:27 +00:00
ruff_rustpython Use consistent Cargo.toml metadata in all crates (#5015) 2023-06-12 00:02:40 +00:00
ruff_textwrap Use consistent Cargo.toml metadata in all crates (#5015) 2023-06-12 00:02:40 +00:00
ruff_wasm [pyupgrade] Restore the keep-runtime-typing setting (#5470) 2023-07-03 02:11:31 +00:00