File tree Expand file tree Collapse file tree
tests/functional/u/undefined Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ What's New in Pylint 2.14.2?
55----------------------------
66Release date: TBA
77
8+ * Avoided raising an identical ``undefined-loop-variable `` message twice on the same line.
9+
810* Don't crash if ``lint.run._query_cpu() `` is run within a Kubernetes Pod, that has only
911 a fraction of a cpu core assigned. Just go with one process then.
1012
Original file line number Diff line number Diff line change @@ -1499,7 +1499,6 @@ def _check_consumer(
14991499 node , nodes .ComprehensionScope
15001500 ):
15011501 self ._check_late_binding_closure (node )
1502- self ._loopvar_name (node )
15031502 return (VariableVisitConsumerAction .RETURN , None )
15041503
15051504 found_nodes = current_consumer .get_next_to_consume (node )
Original file line number Diff line number Diff line change @@ -146,3 +146,11 @@ def use_enumerate():
146146 for i , num in enumerate (range (3 )):
147147 pass
148148 print (i , num )
149+
150+
151+ def find_even_number (container ):
152+ """https://github.com/PyCQA/pylint/pull/6923#discussion_r895134495"""
153+ for something in container :
154+ if something % 2 == 0 :
155+ break
156+ return something # [undefined-loop-variable]
Original file line number Diff line number Diff line change 11undefined-loop-variable:6:11:6:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED
22undefined-loop-variable:25:7:25:11::Using possibly undefined loop variable 'var1':UNDEFINED
33undefined-loop-variable:75:11:75:14:do_stuff_with_redefined_range:Using possibly undefined loop variable 'var':UNDEFINED
4+ undefined-loop-variable:156:11:156:20:find_even_number:Using possibly undefined loop variable 'something':UNDEFINED
You can’t perform that action at this time.
0 commit comments