Skip to content

ALL-CONT0001 · evidence

This page continues ALL-CONT0001 directly from its source docstring. Read its implementation.

Each finding names the declaration, the branch, and the line its alternative opens on. The value is the number of alternatives a jump already made unnecessary.

A branch whose first block ends in ordinary work keeps its else, because there the else is the only thing saying the two blocks exclude each other. An else belonging to a nested branch is charged to that branch and never to the one holding it, which is what reading the indentation buys. A language whose block yields a value instead of jumping, such as a Rust if written as an expression, states no keyword to find and is left alone. A statement that closes its block on a brace or a bare continuation line, rather than on the word that jumps, is left alone too, which under-reports and never over-reports. A branch carrying no span at all is not judged, since nothing then locates the alternative.

  • Generalizes Ruff RET505 superfluous-else-return
  • Generalizes Ruff RET506 superfluous-else-raise
  • Generalizes Ruff RET507 superfluous-else-continue
  • Generalizes Ruff RET508 superfluous-else-break
  • Cites Pylint R1705 no-else-return. Open reference
  • Cites “Go Code Review Comments”, indent error flow. Open reference