ruff/crates/ruff_notebook/resources/test/fixtures/jupyter/cell
Charlie Marsh bea8f2ee3a
Detect automagic-like assignments in notebooks (#9653)
## Summary

Given a statement like `colors = 6`, we currently treat the cell as an
automagic (since `colors` is an automagic) -- i.e., we assume it's
equivalent to `%colors = 6`. This PR adds some additional detection
whereby if the statement is an _assignment_, we avoid treating it as
such. I audited the list of automagics, and I believe this is safe for
all of them.

Closes https://github.com/astral-sh/ruff/issues/8526.

Closes https://github.com/astral-sh/ruff/issues/9648.

## Test Plan

`cargo test`
2024-01-29 12:55:44 +00:00
..
automagic.json Detect and ignore Jupyter automagics (#8398) 2023-11-03 01:14:10 +00:00
automagic_after_code.json Detect and ignore Jupyter automagics (#8398) 2023-11-03 01:14:10 +00:00
automagic_assignment.json Detect automagic-like assignments in notebooks (#9653) 2024-01-29 12:55:44 +00:00
automagic_before_code.json Detect and ignore Jupyter automagics (#8398) 2023-11-03 01:14:10 +00:00
automagics.json Detect and ignore Jupyter automagics (#8398) 2023-11-03 01:14:10 +00:00
cell_magic.json Allow transparent cell magics (#8911) 2023-12-07 14:15:43 -06:00
code_and_magic.json Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
markdown.json Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
only_code.json Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
only_magic.json Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
unicode_magic_gh9145.json Prevent invalid utf8 indexing in cell magic detection (#9146) 2023-12-15 08:15:46 -06:00
valid_cell_magic.json Allow transparent cell magics (#8911) 2023-12-07 14:15:43 -06:00