-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
False positive --py3k
comprehension-escape
#2130
Comments
@PCManticore I found another false positive: https://travis-ci.org/plonegovbr/brasil.gov.agenda/builds/391477517#L2004 this is the code: https://github.com/plonegovbr/brasil.gov.agenda/blob/2.0a1/src/brasil/gov/agenda/tests/test_setup.py#L184-L219 and a snippet: step = [
step for step in upgradeSteps
if (step[0]['dest'] == ('2000',)) and (step[0]['source'] == ('1000',))] |
Hi @hvelarde With what pylint version do you get this false positive? It doesn't reproduces for me using Python 2.7 and pylint 1.9.2. |
yes, it's 1.9.2 and I can reproduce the issue locally: $ python -V
Python 2.7.14
$ grep pylint bin/pylint
'/home/hvelarde/.buildout/eggs/pylint-1.9.2-py2.7.egg',
from pylint import run_pylint
run_pylint()
$ bin/pylint --py3k --disable=no-absolute-import src/brasil/gov/agenda
No config file found, using default configuration
************* Module brasil.gov.agenda.utils
W: 89,48: xrange built-in referenced (xrange-builtin)
************* Module brasil.gov.agenda.content.agendadiaria
W:136,41: basestring built-in referenced (basestring-builtin)
************* Module brasil.gov.agenda.browser.ics
W: 6, 0: Module moved in Python 3 (bad-python3-import)
************* Module brasil.gov.agenda.tests.test_setup
W:189,29: Using a variable that was bound inside a comprehension (comprehension-escape)
W:196,29: Using a variable that was bound inside a comprehension (comprehension-escape)
W:203,29: Using a variable that was bound inside a comprehension (comprehension-escape)
W:212,29: Using a variable that was bound inside a comprehension (comprehension-escape)
W:219,29: Using a variable that was bound inside a comprehension (comprehension-escape)
************* Module brasil.gov.agenda.tests.test_agenda_tile
W: 83,12: Called a next() method on an object (next-method-called)
------------------------------------------------------------------
Your code has been rated at 9.96/10 (previous run: 9.97/10, -0.01)
|
@PCManticore in fact the error is in the line after the list comprehension as you can see in the commits referenced. |
@hvelarde I see where the issue is, the fact that you're using the same variable name for the result of the comprehension and for the iteration step, which is tripping pylint. |
Won't do, we removed the python3 porting mode in 2.11. |
Steps to reproduce
Current behavior
Expected behavior
No errors
A heuristic (that I think is valid?) is that a name
x
is rebound after the comprehension.pylint --version output
The text was updated successfully, but these errors were encountered: