Skip to content

Enable pylint undefined-loop-variable warning #50961

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

Merged
merged 4 commits into from
Jan 26, 2023

Conversation

uzzell
Copy link
Contributor

@uzzell uzzell commented Jan 24, 2023

Enables the Pylint warning undefined-loop-variable. This contributes to (now-closed) #48855 and extends #49740.

Replaces several instances of

for x in my_list:
  foo(x)
bar(x)  # undefined-loop-variable

with

last_element = None
for x in my_list:
  last_element = x
  foo(x)
bar(last_element)  # no undefined-loop-variable

@uzzell uzzell changed the title Undefined loop variable Enable pylint undefined-loop-variable warning Jan 24, 2023
@mroeschke mroeschke added the Code Style Code style, linting, code_checks label Jan 24, 2023
@mroeschke mroeschke added this to the 2.0 milestone Jan 26, 2023
@mroeschke mroeschke merged commit 21399f5 into pandas-dev:main Jan 26, 2023
@mroeschke
Copy link
Member

Thanks @uzzell

@uzzell uzzell deleted the undefined-loop-variable branch January 28, 2023 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants