astral-sh/ruff-vscode

Different sorting behavior on OSX and Linux

andrewblum opened this issue · 7 comments

Hi!

I am running ruff as a pre-commit hook and in a Github action. Both use the same ruff.toml config file, but the local runs are on macbooks and the github action is latest Ubuntu. I am seeing different sorting behavior when I have select ["I"] in the config. In other words, it sorts locally on the macbook but then will fail on the action as being not sorted correctly. I know this was an issue with isort between mac and linux. Anyone encountered this or have suggestions?

Can you share what commands you're running and what ruff versions you're using?

I suspect that this due to CI using Ruff 0.6 but latest extension still ships with ruff 0.5.x unless we dis a release @AlexWaygood ?

I suspect that this due to CI using Ruff 0.6 but latest extension still ships with ruff 0.5.x unless we dis a release @AlexWaygood ?

I did not

I just released 2024.42.0, with an upgraded ruff pin

Locally we run ruff through the vscode extension and also on the command line with ruff check --fix and ruff format as a pre-commit hook. On the github action its ruff check and ruff format --check

What versions are you using locally and in ci?

There could easily be minor (its only been a week) version differences since all the devs installed ruff globally on their own. Did something in the ruff sorting change across releases and you think a pip install --force-reinstall ruff==0.6.1 both locally and in the github action would be sufficient? Doesn't account for the VSCode extension, but I guess we just have to be mindful of staying synced?

It's generally advised to use a single and pinned version (by installing ruff into your venv). It's rare that you experience difference when using different patch versions but even then there's a chance that a bug fix changes some behavior. Minor versions always contain breaking changes. You might be lucky that you're not affected but it seems that this hasn't been the case this time.

The one breaking change that comes to mind is that ruff now treads modules in the src folder as first party. You can read more about the changes in our blog post