Details

    • Type: Language-Specification
    • Status: Active
    • Resolution: Unresolved
    • Labels:
      None
    • Message:
      Delete this unreachable code or refactor the code to make it reachable.
    • Highlighting:
      • Primary Location: the block of code that is unreachable
      • Secondary Locations: the line of code which explain why the code is unreachable (jump statement, continue, ...)
    • Impact:
      Unknown 'null' severity
    • Likelihood:
      Unknown 'null' severity

      Description

      Jump statements (return, break, continue, and raise) move control flow out of the current code block. So any statements that come after a jump are dead code.

      Noncompliant Code Example

      def fun(a):
        i = 10
        return i + a       # Noncompliant 
        i += 1             # this is never executed
      

      Compliant Solution

      def fun(a):
        i = 10
        return i + a
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              elena.vilchik Elena Vilchik
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: