HomePhabricator

[lint] relax the PythonShebangLinter and apply it on electrum

Description

[lint] relax the PythonShebangLinter and apply it on electrum

Summary:
We currently have inconsistencies regarding the linting of python shebangs and file permissions:

  • the linter wants all .py files to have a shebang, but is not applied on electrum code
  • all of the functional test files have a shebang but the file permissions vary (some 644, some 755)

The plan is to introduce a new linter that will force all executable files to have a shebang, and all non executable files to not have a shebang.
We also want to make most python file non-executable (so without a shebang), except for the actual scripts.

This diff is an intermediate step that relaxes the current linter to enforce shebangs only on executable files. It also incidentally adds a check for consistency within the executable flags, as the future linter will only allow 644 and 755 permissions.

In a following scripted diff I will remove the shebang from non script python files and set their permission to 644, and enforce it with the existing linter. Then we can transition to the new linter.

Test Plan:
arc lint --everything

Mess up some files and check that arc lint catches them (chmod 744 file.py, remove a shebang from an executable file)

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
PiRKAuthored on Feb 14 2024, 10:13
PiRKPushed on Feb 14 2024, 16:18
Reviewer
Restricted Project
Differential Revision
D15446: [lint] relax the PythonShebangLinter and apply it on electrum
Parents
rABCad324960a682: [CI deps] Fix hash in nodejs install script
Branches
Unknown
Tags
Unknown