ruff
c03a693e - [pylint] Implement consider-using-ternary (R1706) (#7811)

Commit
2 years ago
[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.
Author
Parents
Loading