Opened 6 years ago

Closed 6 years ago

#27463 closed Cleanup/optimization (fixed)

Fix ambiguous variable flake8 warnings

Reported by: Ramin Farajpour Cami Owned by: Ramin Farajpour Cami
Component: Core (Other) Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Hi,

In some fonts, character 'l' are indistinguishable from the numeral one. So better use other name instead.

https://github.com/django/django/blob/master/tests/queries/tests.py#L567&L574

Change History (14)

comment:1 Changed 6 years ago by Ramin Farajpour Cami

Owner: changed from nobody to Ramin Farajpour Cami
Status: newassigned

comment:2 Changed 6 years ago by Ramin Farajpour Cami

https://pep8.readthedocs.io/en/latest/_modules/pycodestyle.html

    Okay: L = 0
    Okay: o = 123
    Okay: i = 42
    E741: l = 0
    E741: O = 123
    E741: I = 42

comment:3 Changed 6 years ago by Tim Graham

Component: UtilitiesCore (Other)

I'm not sure about this, particularly if our style tool (flake8) doesn't provide automated enforcement. A font that doesn't distinguish between one character or another doesn't seem so useful for programmers.

comment:4 Changed 6 years ago by Ramin Farajpour Cami

really!

Flake8 is a wrapper

PyFlakes
pycodestyle
mccabe

Flake8 uses ranges for mccabe, pyflakes, and pycodestyle because each of those projects tend to add new checks in minor releases.

http://flake8.pycqa.org/en/latest/faq.html#why-does-flake8-use-ranges-for-its-dependencies

Last edited 6 years ago by Ramin Farajpour Cami (previous) (diff)

comment:5 Changed 6 years ago by Ramin Farajpour Cami

pycodestyle member They told me : https://github.com/PyCQA/pycodestyle/issues/598

Allow me for PR ?

Last edited 6 years ago by Ramin Farajpour Cami (previous) (diff)

comment:6 Changed 6 years ago by Aymeric Augustin

I have yet to come across a monospace font where l and I are identical, but it takes less effort to accept a PR making that change than to discuss.

comment:7 Changed 6 years ago by Tim Graham

Summary: ambiguous variable name 'l'Fix ambiguous variable flake8 warnings
Triage Stage: UnreviewedAccepted

comment:8 Changed 6 years ago by Ramin Farajpour Cami

Hi,

i should check ALL files .py django for check this warnings?

comment:9 Changed 6 years ago by Tim Graham

Ideally you could get flake8 working with the latest version of pycodestyle so you can see and fix all the warnings. If it's difficult, then we'll just wait until flake8 is updated.

comment:10 Changed 6 years ago by Ramin Farajpour Cami

Ok, let's go , i need just pycodesyle latest version,

root@raminfp:~# python pycodestyle.py usr/django/django/apps

/usr/django/django/apps/registry.py:425:1: E305 expected 2 blank lines after class or function definition, found 1

i going to fix E305 expected 2 blank lines after class or function definition, found 1, because i see pycodestyle in new version,

Thanks Again,

comment:11 Changed 6 years ago by Ramin Farajpour Cami

comment:12 Changed 6 years ago by Ramin Farajpour Cami

Has patch: set

comment:13 Changed 6 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:14 Changed 6 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 0a63ef3f:

Fixed #27463 -- Fixed E741 flake8 warnings.

Note: See TracTickets for help on using tickets.
Back to Top