-
Notifications
You must be signed in to change notification settings - Fork 23
ruff.toml ignored inside subdir with jupyter-lsp #102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Can you increase the verbosity and send the output? See https://github.com/python-lsp/python-lsp-ruff?tab=readme-ov-file#debugging |
Actually, I misunderstood the problem. python-lsp-ruff/pylsp_ruff/plugin.py Lines 743 to 745 in 041c695
So this is not an issue of |
If that were the case, I would not expect this to work, but it does: ❯ cat subdir/foo.py
import os
❯ cat subdir/ruff.toml
[lint]
ignore = ["F401"]
❯ ruff check subdir/foo.py
All checks passed!
❯ mv subdir/ruff.toml{,.disabled}
❯ ruff check subdir/foo.py
subdir/foo.py:1:8: F401 [*] `os` imported but unused
|
1 | import os
| ^^ F401
|
= help: Remove unused import: `os`
Found 1 error.
[*] 1 fixable with the `--fix` option. I.e. ruff itself respects ruff.toml files in subdirectories of the CWD when checking adjacent (or descendent) sources.
I tried for a long time and still could not figure out how to do this. :( Thanks for any help looking into this. |
cat <...>| python -m ruff check --stdin-filename=subdir/Untitled.ipynb --extension=ipynb:python instead of <cat ...>| python -m ruff check --stdin-filename=.virtual_documents/subdir/Untitled.ipynb --extension=ipynb:python I think this can be achieved by removing the virtual documents dir from the filename: https://jupyterlab-lsp.readthedocs.io/en/latest/Configuring.html#virtual-documents-dir |
I did some playing around. The issue can be solved trivially if |
More of the users I support have been hitting astral-sh/ruff#17117 lately. It'd be great if a |
Assuming you have not set the One solution would be to copy/link the |
We are reliably reproducing this in jupyterlab but I think it's an issue with python-lsp-ruff, so I'm starting by reporting this here (apologies if I'm mistaken).
Reproduction Steps:
uv venv && . .venv/bin/activate
uv pip install jupyterlab jupyterlab-lsp python-lsp-ruff ruff
[1]jupyter lab --notebook-dir=/tmp
import os
and confirm that it triggers error F401, as exectedignore = ["F401"]
in the[lint]
sectionScreen capture of running through this repro:
https://github.com/user-attachments/assets/8cb0710a-0ebf-4279-8633-ab9a13a39901
[1] Click to see `pip freeze` output
The text was updated successfully, but these errors were encountered: