pypa / hatch

Modern, extensible Python project management
https://hatch.pypa.io/latest/
MIT License
5.89k stars 292 forks source link

Hatch 1.12.0 ruff defaults invalid for Ruff 0.6.2 (match upstream flake8-trio/flake8-async) #1695

Open DylanLukes opened 2 weeks ago

DylanLukes commented 2 weeks ago

One of the stated benefits of a persistent ruff_defaults.toml generated by hatch fmt --check --sync is that it enables consistency with external tools. However, the defaults generated break when one uses a new version of ruff for IDE integration via LSP.

This is due to some rules in Ruff being changed to match flake8-async and flake8-trio, as mentioned here: https://github.com/astral-sh/ruff/pull/10416

Problems

Errors:

These no longer exist:

❯ ruff check src
ruff failed
  Cause: Failed to parse redacted/ruff_defaults.toml
  Cause: TOML parse error at line 7, column 1
  |
7 | [lint]
  | ^^^^^^
Unknown rule selector: `ASYNC101`

And likewise for ASYNC102.

Warnings:

warning: `PLR1701` has been remapped to `SIM101`.
warning: `TRIO100` has been remapped to `ASYNC100`.
warning: `TRIO105` has been remapped to `ASYNC105`.
warning: `TRIO109` has been remapped to `ASYNC109`.
warning: `TRIO110` has been remapped to `ASYNC110`.
warning: `TRIO115` has been remapped to `ASYNC115`.
warning: Rule `E999` is deprecated and will be removed in a future release. Syntax errors will always be shown regardless of whether this rule is selected or not.
warning: Rule `UP027` is deprecated and will be removed in a future release.

Proposed Fix

Update the version of ruff used in Hatch to 0.6.x, and make the changes shown above to the default configuration.

Related

Previous: #1084 See also: #1461 (tangentially related)

DylanLukes commented 2 weeks ago

It looks like @DimitriPapadopoulos already has a PR ready at #1588 (which is now for 0.6.2).