Page MenuHomePhabricator

[lint] replace autopep8 with black (test/functional/abc-*)
ClosedPublic

Authored by PiRK on May 10 2023, 08:46.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC87ab57fe9f4c: [lint] replace autopep8 with black (test/functional/abc-*)
Summary

Add a new linter to run black on python files, and start applying it to some files. Remove these files from autopep8. The end goal is to entirely remove autopep8.

Some doc about black:

The --experimental-string-processing makes black split long strings into multiple lines. This seems important to me as not setting it would do the opposite: put the strings we already split back on a single line.

The flake8 E203 error code is incompatible with black, and not PEP8 compliant, so exclude it.

Test Plan

arc lint -- test/functional

test/functional/test_runner.py abc-*

Diff Detail

Repository
rABC Bitcoin ABC
Branch
autopep8_to_black
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23670
Build 46954: Build Diffbuild-diff · build-debug · build-without-wallet · build-clang · build-clang-tidy
Build 46953: arc lint + arc unit

Event Timeline

PiRK requested review of this revision.May 10 2023, 08:46
PiRK edited the summary of this revision. (Show Details)

use triple quotes for docstring as per PEP257

This is not enforced by black, unfortunately.

Fabien requested changes to this revision.May 10 2023, 09:33
Fabien added a subscriber: Fabien.

You need to add black to:

  • The CI install script
  • The CONTRIBUTING document
arcanist/linter/BlackLinter.php
4 ↗(On Diff #40245)

I don't think so

This revision now requires changes to proceed.May 10 2023, 09:33

add black to contributing.md and install-dependencies-bullseye.sh, fix comment in linter

This revision is now accepted and ready to land.May 10 2023, 11:43