-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add ruff linter plugin #1
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @jhossbach for your work on this! I left some simple style suggestions to improve docstrings, otherwise looks good to me.
In case you haven't done it before, please check this guide to apply all my suggestions in a single commit by adding them to the batch.
How do the LSP plugins find the Ruff executable? Do they expect it to be globally available? Or do users point the LSP to an interpreter? |
Co-authored-by: Carlos Cordoba <[email protected]>
You can provide a path to your ruff executable through |
Co-authored-by: Carlos Cordoba <[email protected]>
@jhossbach - Who's responsible for publishing to PyPI? Let me know when it's live and I can give it a try in neovim! |
On it 👍 |
@charliermarsh: The PyPi package is published: https://pypi.org/project/python-lsp-ruff/1.0.0/ |
@jhossbach - For some reason I'm getting this:
...in the Neovim LSP logs. Any ideas? |
Hmm, can you try increasing the log level of pylsp when starting the lsp via nvim? If you use nvim-lspconfig you can specify the command with require("lspconfig").pylsp.setup{ cmd={<path_to_pylsp>, '-vvv', '--log-file', '/tmp/pylsp.log' } } |
Ahh, ok:
|
Most of the settings options in Instead of trying to pass in
...could we instead just pass |
(That may not even be necessary because Ruff will automatically find the nearest |
Good point, I also thought about letting |
@charliermarsh what's the order of configuration input for ruff? Is it project-config -> CLI arguments? Because in that case pylsp needs to at least be able to recognize that a |
To load settings saved on it for other tools. |
Yeah, CLI arguments always have precedence over the I think it should be fine to either: (1) let Ruff handle the |
Created an issue to track at #2. Once resolved, we can probably go ahead and add a reference to this from the Ruff README too. |
WIP for the implementation of ruff linting for pylsp (see this discussion)
It passes the unit tests (as adapted from the flake8 unit tests).
I did come across one very peculiar error from ruff:
Do you have any idea @charliermarsh? I have no MWE so far and could not reproduce this using the CLI (which should work exactly the same compared to
subprocess.Popen
). Maybe an old version?I can upload the plugin to PyPi as soon as the PR is approved and merged.