From faebeb828f5f0ec68d90e7f76add66bc562f6fa3 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 27 Aug 2024 13:17:04 +0200 Subject: [PATCH] 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 --- test/lint/lint-python.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/test/lint/lint-python.py b/test/lint/lint-python.py index 3d0d0203bd1..439d1f1a09c 100755 --- a/test/lint/lint-python.py +++ b/test/lint/lint-python.py @@ -30,28 +30,8 @@ MYPY_FILES_ARGS = ['git', 'ls-files', 'test/functional/*.py', 'contrib/devtools/ ENABLED = ( 'E101,' # indentation contains mixed spaces and tabs - 'E112,' # expected an indented block - 'E113,' # unexpected indentation - 'E115,' # expected an indented block (comment) - 'E116,' # unexpected indentation (comment) - 'E125,' # continuation line with same indent as next logical line - 'E129,' # visually indented line with same indent as next logical line - 'E131,' # continuation line unaligned for hanging indent - 'E133,' # closing bracket is missing indentation - 'E223,' # tab before operator - 'E224,' # tab after operator - 'E242,' # tab after ',' - 'E266,' # too many leading '#' for block comment - 'E271,' # multiple spaces after keyword - 'E272,' # multiple spaces before keyword - 'E273,' # tab after keyword - 'E274,' # tab before keyword - 'E275,' # missing whitespace after keyword - 'E304,' # blank lines found after function decorator - 'E306,' # expected 1 blank line before a nested definition 'E401,' # multiple imports on one line 'E402,' # module level import not at top of file - 'E502,' # the backslash is redundant between brackets 'E701,' # multiple statements on one line (colon) 'E702,' # multiple statements on one line (semicolon) 'E703,' # statement ends with a semicolon @@ -74,7 +54,6 @@ ENABLED = ( 'F631,' # assertion test is a tuple, which are always True 'F632,' # use ==/!= to compare str, bytes, and int literals 'F811,' # redefinition of unused name from line N - 'F812,' # list comprehension redefines 'foo' from line N 'F821,' # undefined name 'Foo' 'F822,' # undefined name name in __all__ 'F823,' # local variable name … referenced before assignment