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

S2208 Should not raise an issue when the only functions called in the module are exception constructors

    Details

    • Type: False-Positive
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Rules
    • Labels:
      None

      Description

      We want to avoid raising issues on wildcard imports when the module containing them is a proxy for other modules, i.e. it only reexport everything from other modules. In these modules it is not uncommon to raise exceptions. RSPEC-2208 currently raises an issue when a function or method is called in the module, it should make an exception when the function called is an exception constructor.

      Example in Pypy

      try:
          from pyrepl.readline import *  # False Positive
      except ImportError:
          import sys
          if sys.platform == 'win32':
              raise ImportError("the 'readline' module is not available on Windows"
                                " (on either PyPy or CPython)")
          raise
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                nicolas.harraudeau Nicolas Harraudeau
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: