Same thing if the if-chain is contained in a loop and the return is a break instead.
Note that not using an elif after causes a behavior change: print("2") will be called when it shouldn't be. These warnings should only trigger if every case in the if/elif/else chain returns, breaks, or raises.
Description
R505 & R508 produce false-positives when an earlier branch does not
return
/break
.What I did
Same thing if the
if
-chain is contained in a loop and thereturn
is abreak
instead.Note that not using an
elif
after causes a behavior change:print("2")
will be called when it shouldn't be. These warnings should only trigger if every case in theif
/elif
/else
chainreturn
s,break
s, orraise
s.