HomePhabricator

[lint] Require flake8-builtins to ensure we do not add shadowing of python…

Description

[lint] Require flake8-builtins to ensure we do not add shadowing of python builtins

Summary:
D13739 eliminates arguments that shadow python builtins (A002) so we should start enforcing that lint rule right away.

A001 (shadowing of variables) can and should be eliminated since it poses similar risk to A002. There are currently 30 instances of A001 in the code base so these need to be cleaned up before we enable this in our linter config.

A003 will remain ignored because it is mostly useless. A003 catches shadowing of class attributes but this does not make sense. For example, the python builtin set() conflicts with a common API pattern that is currently in use by ECKey and ECPubKey. Updating this API just to not conflict with python builtins will be confusing and not actually achieve anything since the attribute cannot conflict with the builtin function call anyway.

Depends on D13739

Test Plan:

pip3 install flake8-builtins

Revert changes to any file from D13675 then:

arc lint

Observe an A002 error code.

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

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

Details

Provenance
sdulfariAuthored on Apr 11 2023, 18:09
sdulfariPushed on Apr 19 2023, 20:04
Reviewer
Restricted Project
Differential Revision
D13740: [lint] Require flake8-builtins to ensure we do not add shadowing of python builtins
Parents
rABCa1e08a5f4a70: [lint] Fix remaining arguments shadowing python builtins
Branches
Unknown
Tags
Unknown