ruff/crates
Charlie Marsh 10ace88e9a
Track conditional deletions in the semantic model (#10415)
## Summary

Given `del X`, we'll typically add a `BindingKind::Deletion` to `X` to
shadow the current binding. However, if the deletion is inside of a
conditional operation, we _won't_, as in:

```python
def f():
    global X

    if X > 0:
        del X
```

We will, however, track it as a reference to the binding. This PR adds
the expression context to those resolved references, so that we can
detect that the `X` in `global X` was "assigned to".

Closes https://github.com/astral-sh/ruff/issues/10397.
2024-03-14 20:45:46 -04:00
..
ruff Require --preview for ruff server (#10368) 2024-03-13 23:52:44 +00:00
ruff_benchmark Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_cache Make all dependencies workspace dependencies (#9333) 2024-01-02 13:41:59 +00:00
ruff_dev Make --config and --isolated global flags (#10150) 2024-03-04 11:19:40 +00:00
ruff_diagnostics Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_formatter Spellcheck & grammar (#10375) 2024-03-13 02:34:23 +00:00
ruff_index Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_linter Track conditional deletions in the semantic model (#10415) 2024-03-14 20:45:46 -04:00
ruff_macros Spellcheck & grammar (#10375) 2024-03-13 02:34:23 +00:00
ruff_notebook Spellcheck & grammar (#10375) 2024-03-13 02:34:23 +00:00
ruff_python_ast Use ExprFString for StringLike::FString variant (#10311) 2024-03-14 13:30:22 +05:30
ruff_python_codegen Unify enums used for internal representation of quoting style (#10383) 2024-03-13 17:19:17 +00:00
ruff_python_formatter Unify enums used for internal representation of quoting style (#10383) 2024-03-13 17:19:17 +00:00
ruff_python_index Fix Indexer fails to identify continuation preceded by newline #10351 (#10354) 2024-03-12 00:35:41 -04:00
ruff_python_literal Unify enums used for internal representation of quoting style (#10383) 2024-03-13 17:19:17 +00:00
ruff_python_parser Unify enums used for internal representation of quoting style (#10383) 2024-03-13 17:19:17 +00:00
ruff_python_resolver Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_python_semantic Track conditional deletions in the semantic model (#10415) 2024-03-14 20:45:46 -04:00
ruff_python_stdlib [pylint] Include builtin warnings in useless-exception-statement (PLW0133) (#10394) 2024-03-13 15:26:11 -04:00
ruff_python_trivia Implement RUF028 to detect useless formatter suppression comments (#9899) 2024-02-28 19:21:06 +00:00
ruff_server Spellcheck & grammar (#10375) 2024-03-13 02:34:23 +00:00
ruff_shrinking Bump version to v0.3.2 (#10304) 2024-03-09 00:24:22 +00:00
ruff_source_file ruff server - A new built-in LSP for Ruff, written in Rust (#10158) 2024-03-08 20:57:23 -08:00
ruff_text_size Range formatting: Fix invalid syntax after parenthesizing expression (#9751) 2024-02-02 17:56:25 +01:00
ruff_wasm Run doctests as part of CI pipeline (#9939) 2024-02-12 10:18:58 +01:00
ruff_workspace Remove F401 fix for __init__ imports by default and allow opt-in to unsafe fix (#10365) 2024-03-13 12:58:25 -05:00