ruff
b302d89d - [`flake8-simplify`] add fix safety section (`SIM110`) (#18114)

Commit
123 days ago
[`flake8-simplify`] add fix safety section (`SIM110`) (#18114) The PR add the `fix safety` section for rule `SIM110` (#15584 ) ### Unsafe Fix Example ```python def predicate(item): global called called += 1 if called == 1: # after first call we change the method def new_predicate(_): return False globals()['predicate'] = new_predicate return True def foo(): for item in range(10): if predicate(item): return True return False def foo_gen(): return any(predicate(item) for item in range(10)) called = 0 print(foo()) # true – returns immediately on first call called = 0 print(foo_gen()) # false – second call uses new `predicate` ``` ### Note I notice that [here](https://github.com/astral-sh/ruff/blob/46be305ad243a5286d4269b1f8e5fd67623d38c2/crates/ruff_linter/src/rules/flake8_simplify/rules/reimplemented_builtin.rs#L60) we have two rules, `SIM110` & `SIM111`. The second one seems not anymore active. Should I delete `SIM111`?
Author
Parents
Loading