Skip to content
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 negative unnecessary-list-index-lookup with iterable kwarg #7770

Closed
clavedeluna opened this issue Nov 14, 2022 · 2 comments · Fixed by #7789
Closed

False negative unnecessary-list-index-lookup with iterable kwarg #7770

clavedeluna opened this issue Nov 14, 2022 · 2 comments · Fixed by #7789
Assignees
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Milestone

Comments

@clavedeluna
Copy link
Collaborator

Bug description

While there are plenty of tests for unnecessary_list_index_lookup, looks like missing is the case for using iterable as a kwarg

# test.py
series = [1, 2, 3]
for idx, val in enumerate(iterable=series, start=0):
    print(series[idx])  # should report [unnecessary-list-index-lookup] but currently isn't

Same code with iterable as an arg correctly reports and is tested.

Configuration

No response

Command used

pylint test.py

Pylint output

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 0.00/10, +10.00)

Expected behavior

test.py:4:10: R1736: Unnecessary list index lookup, use 'val' instead (unnecessary-list-index-lookup)

Pylint version

pylint 2.16.0-dev
astroid 2.12.12
Python 3.11.0

OS / Environment

No response

Additional dependencies

No response

@clavedeluna clavedeluna added the Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling label Nov 14, 2022
@clavedeluna
Copy link
Collaborator Author

Once triaged and accepted by maintainers, I can fix this issue.

@Pierre-Sassoulas Pierre-Sassoulas added False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation and removed Needs triage 📥 Just created, needs acknowledgment, triage, and proper labelling labels Nov 14, 2022
@Pierre-Sassoulas
Copy link
Member

Thank you for opening the issue @clavedeluna !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
False Negative 🦋 No message is emitted but something is wrong with the code Needs PR This issue is accepted, sufficiently specified and now needs an implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants