ruff/crates
Charlie Marsh 69d9212817
Propagate reads on global variables (#11584)
## Summary

This PR ensures that if a variable is bound via `global`, and then the
`global` is read, the originating variable is also marked as read. It's
not perfect, in that it won't detect _rebindings_, like:

```python
from app import redis_connection

def func():
    global redis_connection

    redis_connection = 1
    redis_connection()
```

So, above, `redis_connection` is still marked as unused.

But it does avoid flagging `redis_connection` as unused in:

```python
from app import redis_connection

def func():
    global redis_connection

    redis_connection()
```

Closes https://github.com/astral-sh/ruff/issues/11518.
2024-05-28 14:47:05 -04:00
..
red_knot Sync vendored typeshed stubs (#11428) 2024-05-15 00:46:41 +00:00
ruff Create intermediary directories for `--output-file` (#11550) 2024-05-26 23:23:11 +00:00
ruff_benchmark Use `tokenize` for linter benchmark (#11417) 2024-05-14 10:28:40 -04:00
ruff_cache Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_dev Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_diagnostics Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_formatter Remove some unused `pub` functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_index Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_linter Propagate reads on global variables (#11584) 2024-05-28 14:47:05 -04:00
ruff_macros Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_notebook `ruff server`: Support Jupyter Notebook (`*.ipynb`) files (#11206) 2024-05-21 22:29:30 +00:00
ruff_python_ast Remove some unused `pub` functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_python_ast_integration_tests Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_python_codegen Implement a common trait for the string flags (#11564) 2024-05-27 16:02:01 +01:00
ruff_python_formatter Implement a common trait for the string flags (#11564) 2024-05-27 16:02:01 +01:00
ruff_python_index Implement a common trait for the string flags (#11564) 2024-05-27 16:02:01 +01:00
ruff_python_literal Remove some unused `pub` functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_python_parser Remove some unused `pub` functions (#11576) 2024-05-28 09:56:51 -04:00
ruff_python_resolver chore(deps): update rust crate insta to v1.38.0 (#10701) 2024-04-01 15:44:30 +00:00
ruff_python_semantic Propagate reads on global variables (#11584) 2024-05-28 14:47:05 -04:00
ruff_python_stdlib Regenerate sys.rs with stdlibs==2024.5.15 (#11437) 2024-05-15 22:17:32 +00:00
ruff_python_trivia Move `has_comments` to `CommentRanges` (#11495) 2024-05-22 13:35:16 +00:00
ruff_python_trivia_integration_tests Add `Tokens` newtype wrapper, `TokenKind` iterator (#11361) 2024-05-14 16:45:04 +00:00
ruff_server Make `ruff_notebook` a workspace dependency in `ruff_server` (#11572) 2024-05-28 09:26:39 +02:00
ruff_source_file Move sub-crates to workspace dependencies (#11407) 2024-05-13 14:37:50 +00:00
ruff_text_size Range formatting: Fix invalid syntax after parenthesizing expression (#9751) 2024-02-02 17:56:25 +01:00
ruff_wasm Add `Tokens` newtype wrapper, `TokenKind` iterator (#11361) 2024-05-14 16:45:04 +00:00
ruff_workspace F401 - update documentation and deprecate `ignore_init_module_imports` (#11436) 2024-05-21 09:23:45 -07:00