Closed
Description
Take the test case as an example where there are two cells with unsorted imports.
When run using the following command:
cargo run --bin ruff -- check --select=I001 --no-cache --isolated crates/ruff/resources/test/fixtures/jupyter/isort.ipynb --show-source
The output is a single diagnostic:
crates/ruff/resources/test/fixtures/jupyter/isort.ipynb:cell 1:1:1: I001 [*] Import block is un-sorted or un-formatted
|
1 | / from pathlib import Path
2 | | import random
3 | | import math
4 | | from typing import Any
5 | | import collections
6 | | # Newline should be added here
| |_^ I001
7 | def foo():
8 | pass
|
= help: Organize imports
Found 1 error.
[*] 1 potentially fixable with the --fix option.
While there are 2 import blocks (separated by a cell boundary). The fix produces the correct number which is 2:
$ cargo run --bin ruff -- check --select=I001 --no-cache --isolated crates/ruff/resources/test/fixtures/jupyter/isort.ipynb --fix
Finished dev [unoptimized + debuginfo] target(s) in 0.38s
Running `target/debug/ruff check --select=I001 --no-cache --isolated crates/ruff/resources/test/fixtures/jupyter/isort.ipynb --fix`
Found 2 errors (2 fixed, 0 remaining).