Page MenuHomePhabricator

[LINTER] Enforce a minimum version for autopep8
ClosedPublic

Authored by Fabien on Mar 29 2019, 10:13.

Details

Summary

The behavior of autopep8 differs between older and newer versions.
Enforcing a minimum version is an attempt to enforce the same rules for
everybody, avoiding code conflicts coming to the linter.

The minimum version is selected as being the minimum version shipped
with these OSs:

  • Ubuntu 18.04 (Ubuntu 16.04 version is older but can be easily

updated)

  • Debian testing
  • FreeBSD 12.0
  • OSX 10.12 Sierra
Test Plan

Should return no error:

arc lint -- test/functional/test_runner.py

Diff Detail

Repository
rABC Bitcoin ABC
Branch
autopep8_version_min
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5333
Build 8728: Bitcoin ABC Buildbot (legacy)
Build 8727: arc lint + arc unit

Event Timeline

jasonbcox requested changes to this revision.Mar 29 2019, 16:16
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
arcanist/linter/AutoPEP8Linter.php
40 ↗(On Diff #7867)

Just a heads up this is not future-proof since some scripts/programs only support -v while others support --version exclusively or in addition to -v. We can jump that hurdle when we get there.

42 ↗(On Diff #7867)

To make this less fragile for other version number styles, replace \d+\.\d+\.\d+ with (\.?\d+)* so that it can match x.y x.y.z and x.y.z.u without needing special logic.

This revision now requires changes to proceed.Mar 29 2019, 16:16

I missed the fact that getVersion() is defined in the AutoPEP8Linter that is specific to autopep8. The feedback above is pedantic and not required.

This revision is now accepted and ready to land.Mar 29 2019, 19:21
Fabien planned changes to this revision.Mar 29 2019, 19:26

Accomodate autopep8 version being outputted to sdtout or stderr depending on the version.
Allow for a.b or a.b.c numbering scheme.

This revision is now accepted and ready to land.Mar 30 2019, 08:58
This revision was automatically updated to reflect the committed changes.