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

Not compatible with ruff ≥ 0.5.0 #23

Closed
osvenskan opened this issue Jul 9, 2024 · 3 comments · Fixed by #24
Closed

Not compatible with ruff ≥ 0.5.0 #23

osvenskan opened this issue Jul 9, 2024 · 3 comments · Fixed by #24

Comments

@osvenskan
Copy link

Thanks for pytest-ruff!

As of ruff 0.5.0, ruff no longer accepts the --show-source option (https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md#050, astral-sh/ruff#9814, astral-sh/ruff#12005). As a result, when pytest_ruff executes its check_file() routine (https://github.com/businho/pytest-ruff/blob/main/pytest_ruff/__init__.py#L87), the ruff command fails. When I run the ruff command constructed by pytest_ruff, here's what I get --

$ ruff check my_file.py --quiet --show-source --force-exclude
error: unexpected argument '--show-source' found

  tip: a similar argument exists: '--show-files'

Usage: ruff check <blah blah blah>

For more information, try '--help'.

The --show-source option has been superceded by --output-format. It looks like output-format has been part of ruff since at least version 0.1.0 (based on https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md), so it's probably the backwards and forwards compatible.

@osvenskan
Copy link
Author

For me, replacing --show-source with --output-format=full in check_file() resolves this issue. However, the full option for --output-format wasn't added until ruff 0.2.0. I see in pytest-ruff's pyproject.toml that it supports ruff>=0.0.242, so this fix won't work with the older versions of ruff that pytest-ruff currently supports.

@iurisilvio
Copy link
Contributor

Thanks for the investigation! I'll work on it fast to make sure it works again!

@iurisilvio
Copy link
Contributor

Fixed and released as 0.4.0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants