py-evm icon indicating copy to clipboard operation
py-evm copied to clipboard

Remove linting error ignores

Open veox opened this issue 4 years ago • 1 comments

  • py-evm Version: not yet applicable, true only if/when PR #1940 is merged
  • OS: N/A
  • Python Version (python --version): N/A
  • Environment (relevant diff part for setup.py from linked PR):
     'lint': [
-        "flake8==3.5.0",
-        "flake8-bugbear==18.8.0",
-        "mypy==0.701",
+        "flake8==3.8.2",
+        "flake8-bugbear==20.1.4",
+        "mypy==0.750",
     ],

What is wrong?

The PR added some ignores to tox.ini, it was previously empty:

12 ignore =
13     # E252 missing whitespace around parameter equals                                                               
14     # Already used too much in the codebase at the point of introduction.                                           
15     E252,
16     # W503 line break before binary operator                                                                        
17     # It's either this or W504 (line break _after_ binary operator), pick your poison.                              
18     # W503 gets enabled when E252 gets ignored, see:                                                                
19     # https://github.com/ethereum/py-evm/pull/1940#discussion_r432606845                                            
20     W503

It's quite a lot of lines to change (50? 150?..) in the current codebase, so I did the above instead. (Fiddling with styling shadows valuable git history...)

PEP8's note (use search):

When combining an argument annotation with a default value, however, do use spaces around the = sign:

# Correct:
def munge(sep: AnyStr = None): ...
def munge(input: AnyStr, sep: AnyStr = None, limit=1000): ...

# Wrong:
def munge(input: AnyStr=None): ...
def munge(input: AnyStr, limit = 1000): ...

We don't use spaces there, so flake8 complains.

How can it be fixed

Remove the ignore section, run tox -e py3{6,7,8}-lint and mass-replace = with <space>=<space> in functions where flake8 complains.

veox avatar May 29 '20 20:05 veox

Hello @veox, Team, I'm interested to address this issue if it's fine for you ?

Elnaril avatar Nov 18 '20 18:11 Elnaril