Uploaded image for project: 'SonarPython'
  1. SonarPython
  2. SONARPY-713

RSPEC-5708 (CaughtExceptionsCheck) shouldn't raise on variables holding tuples

    XMLWordPrintable

    Details

    • Type: False-Positive
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.12
    • Component/s: None
    • Labels:
      None

      Description

      exceptions = (ZeroDivisionError, OverflowError)
      try:
        foo = 1/0
      except exceptions: # FP here
        foo = 0
      

      Reported by community: https://community.sonarsource.com/t/python-s5708-does-not-understand-abstracted-tuples/25472

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              andrea.guarino Andrea Guarino
              Reporter:
              andrea.guarino Andrea Guarino
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: