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

Support positional-only parameters (Python 3.8)

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.8
    • Component/s: None
    • Labels:
      None

      Description

      Python 3.8 introduces the possibility to use "/" as a function parameter to indicate that some function parameters must be specified positionally and cannot be used as keyword arguments.

      We should therefore be able to parse the following syntax:

      def f(a, b, /, c, d, *, e, f):
          print(a, b, c, d, e, f)
      

      As we don't make a distinction between positional arguments and keyword arguments in sonar-python at this point, the only thing needed is to be able to avoid parsing errors when encountering this syntax.

      As the "/" parameter is not a regular parameter, there should not be a symbol associated with "/" in the symbol table. We should make sure there is no impact on sonar-security as well (related ticket: SONARSEC-920).

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pierre-yves.nicolas Pierre-Yves Nicolas
              Reporter:
              guillaume.dequenne Guillaume Dequenne
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: