On Mon, May 25, 2020 at 06:17:06PM +0200, Ján Tomko wrote:
On a Monday in 2020, Michal Privoznik wrote:
> On 5/25/20 2:56 PM, Erik Skultety wrote:
> > With newer pycodestyle 2.6.0 (which is part of flake8-3.8.2) reports
> > the following pep violation during syntax-check:
> >
> > ../scripts/check-remote-protocol.py:95:9: E741 ambiguous variable name
'l'
> > for l in err.strip().split("\n")
> >
> > On all the distros we test on, this hasn't occurred yet, but with the
> > future update of flake8 it likely would. The fix is easy, just name the
> > variable appropriately.
> >
> > Signed-off-by: Erik Skultety <eskultet(a)redhat.com>
> > ---
> >
> > The weird thing is that E741 checking has been in pycodestyle since 2.1.0 [1],
> > we now have 2.5.0 and yet only 2.6.0 is complaining about it
> > [1]
https://pycodestyle.pycqa.org/en/latest/developer.html#id8
> >
> > scripts/check-remote-protocol.py | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/check-remote-protocol.py
b/scripts/check-remote-protocol.py
> > index 25caa19563..cf9e3f84a1 100644
> > --- a/scripts/check-remote-protocol.py
> > +++ b/scripts/check-remote-protocol.py
> > @@ -92,8 +92,8 @@ if out == "" or pdwtagsproc.returncode != 0:
> > else:
> > print("WARNING: exit code %d, pdwtags appears broken:" %
> > pdwtagsproc.returncode, file=sys.stderr)
> > - for l in err.strip().split("\n"):
> > - print("WARNING: %s" % l, file=sys.stderr)
> > + for line in err.strip().split("\n"):
> > + print("WARNING: %s" % line, file=sys.stderr)
> > print("WARNING: skipping the remote protocol test",
file=sys.stderr)
> > sys.exit(0)
>
> Ah, the error is about short variable name, it's about 'l' looking too
> similar to 'I' (well, if this is somebody's case then I say use better
> font if you want to code). But in order to shut the checker up:
I won't blindly defend all the PEP guidelines, but they do exist for a reason
and just like we forbade usage of i,k in other that simple loop use cases, this
is a kind of similar on a global scale.
>
Note that we can also shut it up by adding it to our FLAKE8_IGNORE
in build-aux/syntax-check.mk, but I don't care either way.
Of course we can and that was also on the table, but since it's soo trivial to
fix and it's also a good practice IMO, I went for a patch to the source instead.
Thanks for review.
Erik