Closed matejsp closed 6 months ago
Could be related to https://github.com/koxudaxi/ruff-pycharm-plugin/issues/345 but I actually open multiple projects at once (each in its own git repo)
@matejsp Thank you for creating issue. https://github.com/koxudaxi/ruff-pycharm-plugin/issues/345#issuecomment-1889668216 As mentioned here, this plugin only issues commands to the target file in project root unless a custom config path is set. In other words, the plugin does not search for a default config. Please run ruff without the plugin to see if it behaves as expected. Also, please let me know the command.
Yes without the plugin in cmd line ruff works as expected in each of our projects with its own configuration.
At the begining I was using ruff from the first .venv that was in the first project. So I installed pipx install ruff and changed to global ruff: /Users/matej.spiller-muys/.local/bin/ruff
But second project is still using pyproject.toml configuration from the first.
/projects/project1/pyproject.toml
/projects/project1/.venv/...
/projects/project2/pyproject.toml
/projects/project2/.venv/...
Running /Users/matej.spiller-muys/.local/bin/ruff . from command line in project1 or project2 folder, it works without any problems. But not in pycharm.
I even tried running from project1 as current folder as:
/Users/matej.spiller-muys/.local/bin/ruff ../project2
and this is also working as expected.
Basically leaving everything to ruff ... it works.
Is there any default working folder or something else that is taken by default instead of local ruff configuration in pyproject.toml? As soon as I change the configuration in first project it changes also in second project.
Or anything that can be parsed from the logs.
I have recreated the pycharm project from zero ... Basically creating new empty python project in new folder and then attaching two projects.
all
project1
project2
on disk:
/projects/all
/projects/project1
/projects/project2
And I figured out that ruff was not run neither for project1 neither project2 (from previous commnet). BUT as soon as I added pyproject to empty "all" project ... it started highlighting errors based on the configuration in first project. So something fishy is going on :D
I use attach functionality when opening multiple projects so I get them all in one window.
Is there any default working folder or something else that is taken by default instead of local ruff configuration in pyproject.toml?
I expected to choose the project root dir, but from what I hear from you, it seems buggy. I will confirm soon.
Or anything that can be parsed from the logs.
We don't have any method to get logs :( We should implement the option.
BUT as soon as I added pyproject to empty "all" project ... it started highlighting errors based on the configuration in first project. So something fishy is going on :D
@matejsp
I debug your exmaple in my local.
your right ruff uses pyproject.toml
in all project' root.
@matejsp
I have released fixed version 0.0.29
I tested your project structure in my local. And it works. If you find any problem, please re-open this ticket or create an issue.
Thank you for your help!!
It works perfectly! Thank you very much!
Describe the bug I have multiple projects open in pycharm at the same time. Each has its own ruff configuration in pyproject.toml. Some use double some use single quotes.
To Reproduce Open two python projects (attach to current workspace).
First one in pyproject.toml as:
Second one without:
Check the second project in python code:
Expected behavior I would expect ruff to respect individual project settings.
Screenshots Using global or local ruff it is the same problem.
Environments (please complete the following information):