HomePhabricator

[lint] switch from Black to Ruff for python code formatting

Description

[lint] switch from Black to Ruff for python code formatting

Summary:
Ruff yields the same result as Black for 99+% of formatted lines, and it can do both formatting and checking, so this opens the way to replace both Black, flake8 (and all its plugins), isort, flynt... by a single dependency with more capabilites (such as preventing the class of errors fixed in D18896)

The python changes are mostly automated formatting done by the new linter, except for:

  • same line comments move to previous line
  • accidental trailing , removed, to avoid pointless reformatting. These had no effect, turning the result of the line into a tuple then immediately dismissing it

Depends on D18912

Test Plan:

arc liberate
arc lint --everything

ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18904

Details

Provenance
PiRKAuthored on Fri, Nov 7, 08:01
PiRKPushed on Mon, Nov 10, 15:27
Reviewer
Restricted Project
Differential Revision
D18904: [lint] switch from Black to Ruff for python code formatting
Parents
rABCb4ec750c43d7: [lint] add a blank line after module level docstring in python files
Branches
Unknown
Tags
Unknown