mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 21:40:51 -05:00
## Summary fixes #6956 details in issue Following an advice in https://github.com/astral-sh/ruff/issues/6956#issuecomment-1817672585, this change separates expressions to 3 levels of "constant likelihood": * literals, empty dict and tuples... (definitely constant, level 2) * CONSTANT_CASE vars (probably constant, 1) * all other expressions (0) a comparison is marked yoda if the level is strictly higher on its left hand side following https://github.com/astral-sh/ruff/issues/6956#issuecomment-1697107822 marking compound expressions of literals (e.g. `60 * 60` ) as constants this change current behaviour on `SomeClass().settings.SOME_CONSTANT_VALUE > (60 * 60)` in the fixture from error to ok