ruff/crates/ruff_linter
Jake Park c03a693ebc
[pylint] Implement consider-using-ternary (R1706) (#7811)
This is my first PR. Please feel free to give me any feedback for even
small drawbacks.

## Summary

Checks if pre-python 2.5 ternary syntax is used.

Before
```python
x, y = 1, 2
maximum = x >= y and x or y  # [consider-using-ternary]
```

After
```python
x, y = 1, 2
maximum = x if x >= y else y
```

References: 

[pylint](https://pylint.pycqa.org/en/latest/user_guide/messages/refactor/consider-using-ternary.html)
#970 
[and_or_ternary distinction
logic](https://github.com/pylint-dev/pylint/blob/main/pylint/checkers/refactoring/refactoring_checker.py#L1813)

## Test Plan

Unit test, python file, snapshot added.
2023-10-13 01:29:19 +00:00
..
resources/test [pylint] Implement consider-using-ternary (R1706) (#7811) 2023-10-13 01:29:19 +00:00
src [pylint] Implement consider-using-ternary (R1706) (#7811) 2023-10-13 01:29:19 +00:00
Cargo.toml Use crates.io unicode_names2 0.6.0 (#6478) 2023-10-02 18:17:38 -04:00