Open david-waterworth opened 5 months ago
Are you able to share the raw notebook file?
I figured it out, right down the bottom there was as cell I missed containing
559/02408930-81c7-47d7-b2b0-ee38cb3f6e62
Which is clearly invalid - it's actually a fragment of a uri I added at some stage to test something and I should have set the cell to markdown or commented it out. The linter was flagging as an error, I guess the only real issue is the message is a bit cryptic, ideally ruff format
would report the cell number at least, and maybe that this is a linter error - the image below shows what ruff reports in the "Problems" panel of vscode but ruff format
is leaving out some context (also the message below doesn't include the cell number)
Thanks for the details. So, yeah the ruff format
command does not include the cell details while the ruff check
command does:
error: Failed to parse notebooks/syntax_error.ipynb:4:1:5: Invalid decimal integer literal
I can look into it.
Note the ruff check
command isn't really including the cell details either - see below, it has line and column number but not cell number. It works in the vscode "Problems" panel because it's linked, i.e. I can click on the message and it'll jump to the correct cell but the message itself would ideally also contain the cell number (i.e. the first message should have suffix [Cell 24, Line 2, Col 28] if that's possible
I meant that the output in the CLI does provide the correct cell number:
$ ruff check ~/playground/ruff/notebooks/syntax_error.ipynb
error: Failed to parse /Users/dhruv/playground/ruff/notebooks/syntax_error.ipynb:4:1:5: Invalid decimal integer literal
/Users/dhruv/playground/ruff/notebooks/syntax_error.ipynb:cell 4:1:5: E999 SyntaxError: Invalid decimal integer literal
Regarding the VS Code problems tab, I don't know if that's even possible. I'll need to look into it.
Ah right yeah, I don't think it's an issue in the vs code tab, as I mentioned you can click to jump to the problem anyway
I'm getting the error
error: Failed to parse notebooks/tickets v2.ipynb:1:1:5: Invalid decimal integer literal
when I runruff format .
on a project (previously I was using whatever the default vscode formatter is).I assume the :1:1:5 is a reference to a cell but I cannot parse it, does that mean cell 1, line 1 column 5? And is it 0 or 1 based - either way the message doesn't help as the first cell contains
and the second
Also
pre-commit
doesn't seem to complain, not doesformat on save
(vscode setting) which I've configured to use Ruff as the default formatter, it's only when I try and format from the cmd line. I tried escaping the space with\
and surrounding the filename with " "I'm using ruff 0.4.4 (global pipx installation) and my settings are: