astral-sh / ruff-vscode

A Visual Studio Code extension with support for the Ruff linter.
Other
946 stars 45 forks source link

Error: unexpected argument '--format' found #458

Closed vincent-mayer closed 2 months ago

vincent-mayer commented 2 months ago

Hi, when I run the vscode extension I keep getting the following error:

Using interpreter executable: /.pyenv/versions/3.11.6/envs/env/bin/ruff
Running Ruff with: ['/.pyenv/versions/3.11.6/envs/env/bin/ruff', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--format', 'json', '-', '--stdin-filename', 'file.py']
Ruff finished in: 0.004s
error: unexpected argument '--format' found

  tip: to pass '--format' as a value, use '-- --format'

Usage: ruff check <FILES|--fix|--no-fix|--unsafe-fixes|--no-unsafe-fixes|--show-source|--no-show-source|--show-fixes|--no-show-fixes|--diff|--watch|--fix-only|--no-fix-only|--ignore-noqa|--output-format <OUTPUT_FORMAT>|--output-file <OUTPUT_FILE>|--target-version <TARGET_VERSION>|--preview|--no-preview|--select <RULE_CODE>|--ignore <RULE_CODE>|--extend-select <RULE_CODE>|--extend-ignore <RULE_CODE>|--per-file-ignores <PER_FILE_IGNORES>|--extend-per-file-ignores <EXTEND_PER_FILE_IGNORES>|--exclude <FILE_PATTERN>|--extend-exclude <FILE_PATTERN>|--fixable <RULE_CODE>|--unfixable <RULE_CODE>|--extend-fixable <RULE_CODE>|--extend-unfixable <RULE_CODE>|--respect-gitignore|--no-respect-gitignore|--force-exclude|--no-force-exclude|--line-length <LINE_LENGTH>|--dummy-variable-rgx <DUMMY_VARIABLE_RGX>|--no-cache|--cache-dir <CACHE_DIR>|--stdin-filename <STDIN_FILENAME>|--extension <EXTENSION>|--exit-zero|--exit-non-zero-on-fix|--statistics|--add-noqa|--show-files|--show-settings|--ecosystem-ci> <--verbose|--quiet|--silent>

For more information, try '--help'.

my ruff.toml looks like:

line-length = 120

My ruff-version is ruff 0.4.1 and the version of the vscode-extension is v2023.22.0.

My setting.json

    "cmake.configureOnOpen": false,
    "editor.formatOnSave": true,
    "clang-format.executable": "/usr/bin/clang-format-16",
    "C_Cpp.clang_format_path": "/usr/bin/clang-format-16",
    "C_Cpp.formatting": "clangFormat",
    "editor.inlayHints.enabled": "offUnlessPressed",
    "git.autoRepositoryDetection": false,
    "git.detectSubmodules": false,
    "git.ignoreSubmodules": true,
    "ruff.enable": true,
    "ruff.fixAll": true,
    "ruff.run": "onType",

Any help is much appreciated, thanks!

charliermarsh commented 2 months ago

Can you try upgrading the extension? I think you have an incompatible version (we're now on 2024.20.0).

vincent-mayer commented 2 months ago

Just wanted to close this, I had to update my Vscode, now everything works fine. 🙏