flake8-bugbear icon indicating copy to clipboard operation
flake8-bugbear copied to clipboard

B020 Bug

Open btjones0 opened this issue 3 years ago • 1 comments

This is similar to #235 but with sort keys.

for student in sorted(students, key=lambda student: student.last_name):
    ...

results in B020 but it seems like it should be fine.

btjones0 avatar Jun 16 '22 02:06 btjones0

Yeah, I agree if we can find a way to see the scope of student in the lambda I'd happy take that PR.

On the contrary, I do argue tho, it would do nothing but help readability to not use the variable name student in the lambda.

for student in sorted(students, key=lambda student_to_sort: student_to_sort.last_name):

cooperlees avatar Jun 23 '22 14:06 cooperlees

@cooperlees Seems to be fixed now so can be closed :+1:

FozzieHi avatar Mar 13 '23 21:03 FozzieHi

Thanks! Do we know the PR or how did you test it to see it pass?

cooperlees avatar Mar 14 '23 01:03 cooperlees

@cooperlees Just copied the example above and ran flake8 on it.

Looks like this issue is actually a duplicate of #256 which was fixed in #259 although was not actually released when this issue was made. With git checkout b1e4ef296ec6afb6df788d81db0953cf5fd79566~1 the issue is there, and with git checkout b1e4ef296ec6afb6df788d81db0953cf5fd79566 the issue is fixed.

FozzieHi avatar Mar 14 '23 19:03 FozzieHi

Many thanks explaining in case someone disagrees in the future with us for closing this!

cooperlees avatar Mar 14 '23 19:03 cooperlees