[pylint] Implement len-test (PLC1802)#14309
Conversation
|
| code | total | + violation | - violation | + fix | - fix |
|---|---|---|---|---|---|
| PLC1802 | 21 | 21 | 0 | 0 | 0 |
C1802)C1802)
C1802)[pylint] Implement use-implicit-booleaness-not-len (C1802)
[pylint] Implement use-implicit-booleaness-not-len (C1802)[pylint] Implement use-implicit-booleaness-not-len (C1802)
[pylint] Implement use-implicit-booleaness-not-len (C1802)[pylint] Implement use-implicit-booleaness-not-len (PLC1802)
dylwil3
left a comment
There was a problem hiding this comment.
Thanks so much for this contribution! Some minor nits/requests for a few more tests. I also didn't get a chance to review the implementation carefully, but I'll hold off for now in case the new tests inspire any changes.
dylwil3
left a comment
There was a problem hiding this comment.
This looks really great, thank you! I think even with the possible misses around control flow, this makes sense to implement. You would have to be pretty pathological to create a custom class C that implements __len__ and __bool__ where bool(x) != bool(len(x)) for x: C... so I think it's okay.
[pylint] Implement use-implicit-booleaness-not-len (PLC1802)[pylint] Implement len-as-condition (PLC1802)
dylwil3
left a comment
There was a problem hiding this comment.
Almost there! Looking good!
|
Naming: Maybe |
[pylint] Implement len-as-condition (PLC1802)[pylint] Implement len-test (PLC1802`)
[pylint] Implement len-test (PLC1802`)[pylint] Implement len-test (PLC1802)
dylwil3
left a comment
There was a problem hiding this comment.
LGTM, thank you for the great contribution and your patience through all the reviews!
Summary
This PR implements
use-implicit-booleaness-not-len/C1802Test Plan
Checked against pylint tests:
Notes
len-as-conditionmight be solution)References
PEP 8 on empty sequences and implicit booleaness