HomePhabricator

Add linter: Make sure we explicitly open all text files using UTF-8

Description

Add linter: Make sure we explicitly open all text files using UTF-8

Summary:
...encoding in Python.

Backport of core PR13440 and PR13448
https://github.com/bitcoin/bitcoin/pull/13440/files
https://github.com/bitcoin/bitcoin/pull/13448/files

Depends on D3756 and D3759.

The linter has been converted to PHP and integrated into arcanist within
the same diff, as it is simple enough. It also gets improved to behave
correcty when the arguments are spead over multiple lines. It also graps
the open() call nested in another function call.

Test Plan:

./test/functional/test_runner.py
arc lint --everything

Find an open() occurrence in any python file and change the encoding
to encoding='foo'.

arc lint -- <the edited file>

Check the linter returns an error where the encoding has been changed.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
practicalswift <practicalswift@users.noreply.github.com>Authored on Jun 12 2018, 15:49
FabienCommitted on Aug 5 2019, 07:09
FabienPushed on Aug 5 2019, 07:30
Reviewer
Restricted Project
Differential Revision
D3772: Add linter: Make sure we explicitly open all text files using UTF-8
Parents
rSTAGINGbea7df23cadd: tests/tools: Enable additional Python flake8 rules for automatic linting
Branches
Unknown
Tags
Unknown