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 positive ImplicitEnumerateViolation on range with step #1742

Closed
AlwxSin opened this issue Nov 23, 2020 · 2 comments · Fixed by #1792
Closed

False positive ImplicitEnumerateViolation on range with step #1742

AlwxSin opened this issue Nov 23, 2020 · 2 comments · Fixed by #1792
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@AlwxSin
Copy link
Contributor

AlwxSin commented Nov 23, 2020

Bug report

What's wrong

A simple function that splits a list into chunks

def chunks(lst, amount):
    for index in range(0, len(lst), amount):
        yield lst[index:index + amount]

will raise ImplicitEnumerateViolation.

Documentation suggests using enumerate(lst) instead of range(0, len(list)) but there is no step

How it should be

ImplicitEnumerateViolation should not raise if step > 0 in range arguments.

@AlwxSin AlwxSin added the bug Something isn't working label Nov 23, 2020
@sobolevn
Copy link
Member

@AlwxSin fix is welcome!

@AlwxSin
Copy link
Contributor Author

AlwxSin commented Dec 1, 2020

@sobolevn yeah. I'll try to fix it in a week or two if no one else wouldn't take it.

@sobolevn sobolevn added the help wanted Extra attention is needed label Dec 1, 2020
@sobolevn sobolevn added this to the Version 0.15 aka Python3.9 milestone Dec 1, 2020
AlwxSin added a commit to AlwxSin/wemake-python-styleguide that referenced this issue Dec 22, 2020
AlwxSin added a commit to AlwxSin/wemake-python-styleguide that referenced this issue Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants