-
Notifications
You must be signed in to change notification settings - Fork 88
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
How to set up apheleia for ruff? #351
Comments
And what's in that buffer? |
You need to report what is in that log buffer, as otherwise it's not possible to tell what's wrong. |
The contents of the apheleia-ruff-log* buffer are as follows (no output on stderr) Command failed with exit code 2. |
Sounds like the formatter is failing. Is the input code syntactically valid? If so, this is a bug that needs to be reported upstream. |
The above python code is syntactically correct. |
Oh. You formatted it as a single line, but you meant to format it as multiple lines. I fixed it for you by editing your comment. |
That said, your code is not syntactically correct. There's no statement after the last line. The formatter is thus correctly throwing an error. |
The original code is below:
I expect the formatted code to look like this:
I'm not sure if it's possible to format it for the incomplete code snippet above.
not formatted. |
No, that's not why it's throwing an error. It's throwing an error because your code isn't syntactically valid. If you want Ruff to be able to format the code you provided, you need to report an issue to that project. This doesn't relate to Apheleia. |
Can confirm that ruff doesn't seem to work on the following file:
In the
I'm not sure how to test the provided ruff command, but here's what I got: $ ruff format --silent --stdin-filename /.../test.org -
import numpy
rng = numpy.random.default_rng()<C-d>
import numpy
rng = numpy.random.default_rng() I'm using ruff v0.9.7, doom emacs with the following
and apheleia d8ccc0b. |
My configuration is as follows:
(use-package apheleia
:ensure t
:config
(apheleia-global-mode t)
(with-eval-after-load 'apheleia
(setf (alist-get 'python-mode apheleia-mode-alist)
'(ruff-isort ruff))
(setf (alist-get 'python-ts-mode apheleia-mode-alist)
'(ruff-isort ruff))
) )
You often get the following prompt in python files:
Failed to run ruff: exit status 2 (see buffer apheleia-ruff-log)?
Mac, emacs-plus@31
The text was updated successfully, but these errors were encountered: