Opened 7 years ago

Closed 7 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 by Ramin Farajpour Cami, 7 years ago

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

comment:2 by Ramin Farajpour Cami, 7 years ago

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 by Tim Graham, 7 years ago

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 by Ramin Farajpour Cami, 7 years ago

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 7 years ago by Ramin Farajpour Cami (previous) (diff)

comment:5 by Ramin Farajpour Cami, 7 years ago

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

Allow me for PR ?

Version 0, edited 7 years ago by Ramin Farajpour Cami (next)

comment:6 by Aymeric Augustin, 7 years ago

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 by Tim Graham, 7 years ago

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

comment:8 by Ramin Farajpour Cami, 7 years ago

Hi,

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

comment:9 by Tim Graham, 7 years ago

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 by Ramin Farajpour Cami, 7 years ago

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 by Ramin Farajpour Cami, 7 years ago

comment:12 by Ramin Farajpour Cami, 7 years ago

Has patch: set

comment:13 by Tim Graham, 7 years ago

Triage Stage: AcceptedReady for checkin

comment:14 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In 0a63ef3f:

Fixed #27463 -- Fixed E741 flake8 warnings.

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