Fail to recognize the Ruff config file path for lintning in the VSCode settings.json
Environment
Ruff Extension: v2024.24.0 VSCode: 1.88.1 OS: Windows 10 Python: 3.8.15 Ruff: 0.4.7 Import Strategy: fromEnvironment
Description
"ruff.lint.args": [
"--config=${workspaceFolder}/pyproject.toml"
],
"ruff.format.args": [
"--config=${workspaceFolder}/pyproject.toml"
]
Here is the error message.
Ruff: Lint failed (error: invalid value '${workspaceFolder}/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 `{workspaceFolder}/pyproject.toml` does not exist For more information, try '--help'. )
Formatting works well and recognizes the path to pyproject.toml, unfortunately the error appears with the same path for lint.
Thanks!
Can you try this with the latest version? It's working fine for me i.e., it's expanding the ${workspaceFolder} variable:
2024-07-23 09:50:19.778 [info] Running Ruff with: /Users/dhruv/.local/bin/ruff ['check', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--output-format', 'json', '-', '--config=/Users/dhruv/playground/ruff/pyproject.toml', '--stdin-filename', '/Users/dhruv/playground/ruff/src/lsp.py']
You can refer to logs with either Ruff: Show Logs command or Developer: Show Logs (select "Ruff").
Closing this as resolved. Both these settings are now deprecated and the recommendation is to switch to using ruff.configuration instead which also supports expanding variables like ${workspaceFolder}. Feel free to ask any other questions that you might have.