Commit Graph

9 Commits

Author SHA1 Message Date
MarcoFalke
fafdb7df34
lint: Speed up flake8 checks
Previously they may have taken more than 10 seconds. Now they should
finish in less than one second.

This also allows to drop one dependency to be installed.
2024-08-29 07:03:42 +02:00
MarcoFalke
faebeb828f
lint: Remove python whitespace and shadowing lint rules
The rules have many issues:

* Most are redundant, because Python already has a built-in
  IndentationError, a subclass of SyntaxError, to enforce whitespace.
* They are not enforced consistently anyway, see for examples [1][2]
  below.
* They are stylistic rules where the author intentionally formatted the
  code to be easier to read. Starting to enforce them now would make the
  code harder to read and create frustration in the future.

Fix all issues by removing them.

[1]:
test/functional/feature_cltv.py:63:35: E272 [*] Multiple spaces before keyword
   |
61 |         # | Script to prepend to scriptSig                  | nSequence  | nLockTime    |
62 |         # +-------------------------------------------------+------------+--------------+
63 |         [[OP_CHECKLOCKTIMEVERIFY],                            None,       None],
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ E272

[2]:
contrib/asmap/asmap.py:395:13: E306 [*] Expected 1 blank line before a nested definition, found 0
    |
393 |             prefix.pop()
394 |             hole = not fill and (lhole or rhole)
395 |             def candidate(ctx: Optional[int], res0: Optional[list[ASNEntry]],
    |             ^^^ E306
2024-08-29 07:02:03 +02:00
MarcoFalke
7777047835
lint: Remove python lint rules that are SyntaxError
Any kind of syntax error is already reported, so there is no need to
enumerate all possible types of syntax errors of ancient versions of
Python 2 or 3.
2024-08-29 07:01:55 +02:00
Fabian Jahr
f9047771d6
lint: fix custom mypy cache dir setting 2023-09-28 13:20:25 +02:00
Jon Atack
6c008a2006 script: replace deprecated pkg_resources with importlib.metadata
in our python linter:

```
./test/lint/lint-python.py:12: DeprecationWarning: pkg_resources is deprecated as an API.
  See https://setuptools.pypa.io/en/latest/pkg_resources.html
  import pkg_resources
```

The importlib.metadata library was added in Python 3.8, which is currently our
minimum-supported Python version.

For more details about importlib.metadata, see https://docs.python.org/3/library/importlib.metadata.html
2023-08-26 16:42:02 -06:00
fanquake
015cc5e588
lint: stop ignoring LIEF imports
Type stubs are now available as of 0.13.0.
See https://github.com/lief-project/LIEF/issues/650.
2023-05-29 10:23:52 +01:00
Pieter Wuille
621c17869d Respect and update FILES_ARGS in test/lint/lint-python.py 2023-04-14 10:52:33 -04:00
Leonardo Lazzaro
61bb4e783b lint: enable E722 do not use bare except 2023-02-18 11:24:09 +00:00
Fabian Jahr
47b66ac4ac
lint: Convert Python linter to Python 2022-04-18 00:55:06 +02:00