ruff/crates/ruff_python_ast
Jesse Serrao 39728a1198
Add check for is comparison with mutable initialisers to rule F632 (#8607)
## Summary

Adds an extra check to F632 to check for any `is` comparisons to a
mutable initialisers.
Implements #8589 .

Example:
```Python
named_var = {}
if named_var is {}:  # F632 (fix)
    pass
```
The if condition will always evaluate to False because it checks on
identity and it's impossible to take the same identity as a hard coded
list/set/dict initializer.

## Test Plan

Multiple test cases were added to ensure the rule works + doesn't flag
false positives + the fix works correctly.
2023-11-11 00:29:23 +00:00
..
src Add check for is comparison with mutable initialisers to rule F632 (#8607) 2023-11-11 00:29:23 +00:00
tests Split Constant to individual literal nodes (#8064) 2023-10-30 12:13:23 +05:30
Cargo.toml Implement our own small-integer optimization (#7584) 2023-09-25 15:13:21 +00:00