File tree 4 files changed +11
-1
lines changed
tests/functional/u/undefined
4 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ What's New in Pylint 2.14.2?
5
5
----------------------------
6
6
Release date: TBA
7
7
8
+ * Avoided raising an identical ``undefined-loop-variable `` message twice on the same line.
9
+
8
10
* Don't crash if ``lint.run._query_cpu() `` is run within a Kubernetes Pod, that has only
9
11
a fraction of a cpu core assigned. Just go with one process then.
10
12
Original file line number Diff line number Diff line change @@ -1499,7 +1499,6 @@ def _check_consumer(
1499
1499
node , nodes .ComprehensionScope
1500
1500
):
1501
1501
self ._check_late_binding_closure (node )
1502
- self ._loopvar_name (node )
1503
1502
return (VariableVisitConsumerAction .RETURN , None )
1504
1503
1505
1504
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():
146
146
for i , num in enumerate (range (3 )):
147
147
pass
148
148
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 1
1
undefined-loop-variable:6:11:6:14:do_stuff:Using possibly undefined loop variable 'var':UNDEFINED
2
2
undefined-loop-variable:25:7:25:11::Using possibly undefined loop variable 'var1':UNDEFINED
3
3
undefined-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