Remove Unreachable Code
Documentation Index
Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
Use this file to discover all available pages before exploring further.
Sourcery refactoring id: remove-unreachable-code
Section titled “Sourcery refactoring id: remove-unreachable-code”Description:
Section titled “Description:”Removes code that will never be executed
Before:
Section titled “Before:”for a in b: do_a() continue do_x() do_y()After:
Section titled “After:”for a in b: do_a() continueExplanation:
Section titled “Explanation:”Statements after a continue, return or raise will never be executed.
Leaving them in the code confuses the reader, who may believe that these
statements have some effect. They should therefore be removed.