ruff/crates/ruff_linter
Vasco Schiavo b302d89da3
[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](46be305ad2/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`?
2025-05-19 16:38:08 -04:00
..
resources [airflow] Update AIR301 and AIR311 with the latest Airflow implementations (#17985) 2025-05-19 13:28:04 -04:00
src [flake8-simplify] add fix safety section (SIM110) (#18114) 2025-05-19 16:38:08 -04:00
Cargo.toml Bump 0.11.10 (#18120) 2025-05-15 09:54:08 -04:00