ruff/crates/ruff_notebook/resources/test/fixtures/jupyter
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
..
cell Detect automagic-like assignments in notebooks (#9653) 2024-01-29 12:55:44 +00:00
add_missing_cell_id.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
after_fix.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
before_fix.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
invalid_extension.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
ipy_escape_command.ipynb Allow transparent cell magics (#8911) 2023-12-07 14:15:43 -06:00
ipy_escape_command_expected.ipynb Allow transparent cell magics (#8911) 2023-12-07 14:15:43 -06:00
isort.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
isort_expected.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
no_cell_id.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
no_trailing_newline.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
not_json.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
R.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
undefined_name.ipynb Detect automagic-like assignments in notebooks (#9653) 2024-01-29 12:55:44 +00:00
unused_variable.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
unused_variable_expected.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
valid.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00
wrong_schema.ipynb Create ruff_notebook crate (#7039) 2023-09-01 13:56:44 +00:00