Closed trim21 closed 1 month ago
I'm afraid I can't reproduce the problem in any running mode.
What are your settings? Have you tried restarting the IDE and/or your computer?
If restarting doesn't work, could you check the logs (Ctrl + Shift + A → Show Log in Explorer) and let me see its content? An email is fine if you don't want to post it publicly: <myusername>@gmail.com
.
2024-09-20 02:26:05,989 [94317252] INFO - #c.i.a.o.PathMacrosImpl - Saved path macros: {}
2024-09-20 02:26:16,220 [94327483] INFO - #insyncwithfoo.ryecharm.Command - Running: (C:\Users\Trim21\proj\python\transmission-rpc) C:\Users\Trim21\scoop\shims\ruff.exe check --no-fix --exit-zero --quiet - --output-format json --stdin-filename C:\Users\Trim21\proj\python\transmission-rpc\docs\client.rst
2024-09-20 02:26:16,274 [94327537] INFO - #insyncwithfoo.ryecharm.Command - <long output content removed>
my ruff config:
[tool.ruff]
target-version = "py38"
extend-exclude = ["docs"]
line-length = 120
[tool.ruff.lint]
select = [
"B",
"C",
"E",
"F",
"G",
"I",
"N",
"Q",
"S",
"W",
"BLE",
"EXE",
"ICN",
"INP",
"ISC",
"NPY",
"PD",
"PGH",
"PIE",
"PL",
"PT",
"PYI",
"RET",
"RSE",
"RUF",
"SIM",
"SLF",
"TCH",
"TID",
"TRY",
"YTT",
"UP",
"FA100",
"FA102"
]
extend-fixable = ['UP']
ignore = [
'PLR0911',
'INP001',
'N806',
'N802',
'N803',
'E501',
'BLE001',
'RUF002',
'S301',
'S314',
'S101',
'N815',
'S104',
'C901',
'ISC003',
'PLR0913',
'RUF001',
'SIM108',
'TCH003',
'RUF003',
'RET504',
'TCH001',
'TRY300',
'TRY003',
'TRY201',
'TRY301',
'PLR0912',
'PLR0915',
'PLR2004',
'PGH003',
]
I'm not sure if this help, but I'm editing doc files in this git repo https://github.com/trim21/transmission-rpc
Thanks. I can reproduce it now.
Unbelievable as it is, RyeCharm is working correctly. It is supposed to run Ruff on any Python file; a file is considered a Python file if it passes at least one of the following two criteria:
py
or pyi
.PyFile
interface (in this case, PyFileImpl
).I always thought PyFile
is reserved for, well, Python files (and injected Python fragments). I was wrong.
The annotator was indeed passed a PyFile
. However, this PSI file seems to be used only as the host for the actual, injected .rst
PSI file (and injected files are not passed to annotators). Regardless, the PyFile
in question is still linked to your .rst
file, text and all; its .language
is also the same as that of normal Python files. I have no idea why this is even the case.
I'll add an extra check, but this is more of a design bug on PyCharm's side (see also PY-73814).
I'll add an extra check, but this is more of a design bug on PyCharm's side.
At least ruff extend-exclude
should work, docs directory is already excluded in ruff config.
At least ruff
extend-exclude
should work
The file's content is passed via standard input (note the -
in the command). I might have to reconsider this decision if it proves to be too confusing. Note that letting Ruff reads the file itself isn't without its problems either: I would have to save the file beforehand.
Anyway, try the build out and let me know if it works.
I think it works
Ruff reads the file itself
ruff will ignore exclude config if it's called with ruff check /path/to/file
I'm guessing the exclude config would work if I use LSP instead of cli?
I'm guessing the exclude config would work if I use LSP instead of cli?
Haven't rechecked, but that's probably correct.
Yes files get excluded as expected in LSP mode.
I suppose this issue is solved then. If nothing changes I'll merge the fix tomorrow.
thanks
What happened?
ryecharm run ruff on rst file and report syntax error
looks like it run ruff on rst file directly
ruff check .\docs\enum.rst
Steps to reproduce
create a rst file and open it with ryecharm plugin
Relevant log output or stack trace
No response
Operating system
None