Fail to recognize the Ruff config file path in the VSCode settings.json
ArcticOc opened this issue · 5 comments
ArcticOc commented
Environment
Ruff: v2024.12.0
VSCode: 1.86.2 (Universal)
OS: Mac Os 14.3
Description
"ruff.lint.args": [
"--config=$HOME/.config/pyproject.toml"
],
Here is the error message.
Ruff: Lint failed (error: invalid value '$HOME/.config/pyproject.toml' for '--config <CONFIG_OPTION>' tip: A `--config` flag must either be a path to a `.toml` configuration file or a TOML `<KEY> = <VALUE>` pair overriding a specific configuration option It looks like you were trying to pass a path to a configuration file. The path `$HOME/.config/pyproject.toml` does not exist For more information, try '--help'. )
This path value used to be fine, but it seems to be invalid after the most recent update to Ruff or VSCode.
Thanks!
MichaReiser commented
Hmm. It could be because we fail to expand $HOME.
erjac77 commented
We have the same problem using environment variables like ${env:PYTHON_VERSION}
in path.
"ruff.path": [
"${workspaceFolder}/dist/export/python/virtualenvs/ruff/${env:PYTHON_VERSION}/bin/ruff"
]
The error message:
Interpreter executable (/workspace/dist/export/python/virtualenvs/ruff/${env:PYTHON_VERSION}/bin/ruff) not found
Seems like predefined variables are expanded, but not the environment variables.
alkatar21 commented
I have a similar problem:
"ruff.format.args": [
"--config",
"~/AppData/Roaming/Code/User/pyproject.toml",
],
This worked fine until 2024.10.0
and throws the following error since 2024.12.0
:
[info] error: invalid value '~/AppData/Roaming/Code/User/pyproject.toml' for '--config <CONFIG_OPTION>'
charliermarsh commented
Yeah, we're failing to expand things there. I will fix now.
charliermarsh commented
Fix here: astral-sh/ruff#10219