Page MenuHomePhabricator

Integrates the python format linter with arcanist
ClosedPublic

Authored by Fabien on Feb 15 2019, 20:36.

Details

Summary

Running arc lint or arc diff will run the linter-python-format.py
script on all the python files in the diff (excepted the linter itself
to avoid erasing the doctest).
It will automatically propose to amend the diff with the new format
applied to file, in the same way that autopep8 or clang-format do.

Depends on D2557

Test Plan

Add a comment in test/functional/test_framework/messages.py then run
arc lint.
Check that arcanist offer to amend 31 format replacements for the file.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
arcanist_lint_python_format
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 5006
Build 8075: Bitcoin ABC Buildbot (legacy)
Build 8074: arc lint + arc unit

Event Timeline

.arclint
47 ↗(On Diff #7364)

You probably want a $ at the end

deadalnix requested changes to this revision.Feb 16 2019, 00:55
deadalnix added inline comments.
arcanist/linter/PythonFormatLinter.php
97 ↗(On Diff #7364)

Remove

This revision now requires changes to proceed.Feb 16 2019, 00:55
Fabien planned changes to this revision.Feb 16 2019, 08:08
Fabien added inline comments.
.arclint
47 ↗(On Diff #7364)

Good catch, let's avoid linting the .pyc file. Also I missed to escape the dot.

arcanist/linter/PythonFormatLinter.php
97 ↗(On Diff #7364)

Thanks, you made me discover this rule !

Remove php closing tag and fix linter exclusion filter in .arclint

This revision is now accepted and ready to land.Feb 16 2019, 13:35

Rtrim the original content in arcanist message.
Under some circumstance arcanist would also replace the line break,
resulting in 2 lines being merged.

This revision was automatically updated to reflect the committed changes.