ID: py/unreachable-statement Kind: problem Security severity: Severity: warning Precision: very-high Tags: - maintainability - useless-code - external/cwe/cwe-561 Query suites: - python-security-and-quality.qls
Unreachable code makes the code more difficult to understand and may slow down loading of modules.
Deleting the unreachable code will make the code clearer and preserve the meaning of the code. However, it is possible that the original intention was that the code should execute and that it is unreachable signifies some other error.
In this example the assignment to
remainder is never reached because there is a
return statement on the previous line.
import math def my_div(x, y): return math.floor(x / y) remainder = x - math.floor(x / y) * y