Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: Found argument '--force-exclude' which wasn't expected, or isn't valid in this context #174

Closed
charliermarsh opened this issue Apr 19, 2023 · 0 comments · Fixed by astral-sh/ruff-lsp#145
Labels
bug Something isn't working

Comments

@charliermarsh
Copy link
Member

Originally posted in the Ruff repo via astral-sh/ruff#4017:

I'm using the vscode extension and whenever I try to run Ruff: Format imports on my python file I get this error, which I found in the log output:

Using environment executable: /usr/local/Caskroom/miniconda/base/bin/ruff
Inferred version ruff 0.0.135 for: /usr/local/Caskroom/miniconda/base/bin/ruff
Running Ruff with: ['/usr/local/Caskroom/miniconda/base/bin/ruff', '--force-exclude', '--no-cache', '--no-fix', '--quiet', '--format', 'json', '-', '--fix', '--extend-ignore', 'ALL', '--extend-select', 'I001', '--stdin-filename', '/Users/amytroschinetz/source/spellbot/src/spellbot/services/games.py']
error: Found argument '--force-exclude' which wasn't expected, or isn't valid in this context

  If you tried to supply '--force-exclude' as a value rather than a flag, use '-- --force-exclude'

Usage: ruff [OPTIONS] <FILES>...

For more information try '--help'

vscode indicates that the version installed is v2023.12.0.

From my vscode settings:

  "ruff.importStrategy": "fromEnvironment"
/usr/local/Caskroom/miniconda/base/bin/ruff --version
ruff 0.0.135
poetry run ruff --version
ruff 0.0.261

I think ruff is using the wrong path. In vscode the python environment that I have selected is ./env. But the extension seems to be using my miniconda environment for some reason.

Here you can see I've selected the local virtualenv, so it should be using the ruff from here:

Screenshot 2023-04-18 at 11 27 47 PM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant