astral-sh / rye

a Hassle-Free Python Experience
https://rye.astral.sh
MIT License
13.6k stars 466 forks source link

`—diff` flag from ruff not recognized on `rye fmt` and `rye lint` #1311

Closed JackDyre closed 1 month ago

JackDyre commented 1 month ago

Steps to Reproduce

ruff check —fix —diff

rye lint —diff error: unexpected argument found

ruff format —diff

rye fmt —diff error: unexpected argument found

Expected Result

I assume rye uses ruff for linting and formatting. I would expect the—diff flag from ruff format and ruff check —fix to work with rye.

Actual Result

error: unexpected argument found

Version Info

Version 0.38.0

Stacktrace

No response

my1e5 commented 1 month ago

Extra args need to be passed in after a --, so it needs to be

rye lint -- --diff

or

rye fmt -- --diff

This is documented in the --help but it can be easy to miss I agree

$ rye lint --help
Run the linter on the project.

This invokes ruff in lint mode.

Usage: rye.exe lint [OPTIONS] [PATHS]... [-- <EXTRA_ARGS>...]

Arguments:
  [PATHS]...
          List of files or directories to limit the operation to

  [EXTRA_ARGS]...
          Extra arguments to ruff

Other issues where people missed the -- part needed for extra args: https://github.com/astral-sh/rye/issues/1146.

JackDyre commented 1 month ago

Thanks! Just a RTFM moment on my part.