hatch icon indicating copy to clipboard operation
hatch copied to clipboard

Upgrade Ruff to 0.11.12

Open DimitriPapadopoulos opened this issue 11 months ago • 1 comments

  • Run scripts/update_ruff.py to update.
  • Handle this error manually:
    ruff failed
      Cause: Selection of deprecated rules is not allowed when preview is enabled. Remove selection of:
        - S320
    	- UP038
    
  • Handle these warnings manually:
    warning: `TCH001` has been remapped to `TC001`.
    warning: `TCH002` has been remapped to `TC002`.
    warning: `TCH003` has been remapped to `TC003`.
    warning: `TCH004` has been remapped to `TC004`.
    warning: `TCH005` has been remapped to `TC005`.
    warning: `TCH010` has been remapped to `TC010`.
    warning: `TRY302` has been remapped to `TRY203`.
    

DimitriPapadopoulos avatar Jan 15 '25 18:01 DimitriPapadopoulos

The linter target should be py38 but hatch fmt --check clearly uses a more recent target, hence the CI errors.

Any clue how the target Python version is chosen?

DimitriPapadopoulos avatar Jan 15 '25 18:01 DimitriPapadopoulos

I have extracted some commits to #2063 to simplify this PR.

DimitriPapadopoulos avatar Sep 27 '25 22:09 DimitriPapadopoulos

I can remove the last commit: https://github.com/pypa/hatch/pull/1890/commits/8d75a8e046c07600186ab6b7c32c326bb650f604.

CI will fail until quoting is fixed: https://github.com/pypa/hatch/blob/136c763a2a348eab0ab214c2c0f1895dc721c9c9/ruff.toml#L8

DimitriPapadopoulos avatar Sep 27 '25 22:09 DimitriPapadopoulos

Do you know how large of a diff it would be to move to double quotes now? The only reason I'm worried about mass changes is because someone is working on the workspaces branch and I don't want to introduce many conflicts until their work is merged.

ofek avatar Sep 27 '25 22:09 ofek

I am okay with moving to double quotes, I can handle the rebase locally for double quotes changes even with a large diff. A lot of the work so far has been mostly around fixing the unit tests and getting to a working build state then getting to the remaining implementation details.

cjames23 avatar Sep 27 '25 22:09 cjames23

Okay then, please switch everything to double quotes in this PR!

ofek avatar Sep 27 '25 23:09 ofek

Done.

  1. Modify ruff.toml.
  2. Run ruff format.

Changes are a little bit massive, not easy to review. You might want to rerun locally to make sure my last commit does what it pretends it does...

DimitriPapadopoulos avatar Sep 28 '25 17:09 DimitriPapadopoulos