ruff/crates/ruff_notebook/resources/test/fixtures/jupyter/cell
Dhruv Manilawala ff53db3d99
Consider VS Code cell metadata to determine valid code cells (#12864)
## Summary

This PR adds support for VS Code specific cell metadata to consider when
collecting valid code cells.

For context, Ruff only runs on valid code cells. These are the code
cells that doesn't contain cell magics. Previously, Ruff only used the
notebook's metadata to determine whether it's a Python notebook. But, in
VS Code, a notebook's preferred language might be Python but it could
still contain code cells for other languages. This can be determined
with the `metadata.vscode.languageId` field.

### References:
* https://code.visualstudio.com/docs/languages/identifiers
* e6c009a3d4/extensions/ipynb/src/serializers.ts (L104-L107)
*
e6c009a3d4/extensions/ipynb/src/serializers.ts (L117-L122)

This brings us one step closer to fixing #12281.

## Test Plan

Add test cases for `is_valid_python_code_cell` and an integration test
case which showcase running it end to end. The test notebook contains a
JavaScript code cell and a Python code cell.
2024-08-13 22:09:56 +05:30
..
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
markdown.json
only_code.json
only_magic.json
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
vscode_language_id_javascript.json Consider VS Code cell metadata to determine valid code cells (#12864) 2024-08-13 22:09:56 +05:30
vscode_language_id_python.json Consider VS Code cell metadata to determine valid code cells (#12864) 2024-08-13 22:09:56 +05:30