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

Rule S930: Keyword only arguments impact positional arguments count

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7
    • Fix Version/s: None
    • Component/s: Rules
    • Labels:

      Description

      I see the following behavior on Rule S930.

      def func0(arg, *, foo=1):
          pass  # empty
      
      func0(1, 2)  # False negative
      
      def func1(arg, *, foo=1):
          pass
      
      func1(1, 2, foo=1)  # Issue: "Remove 1 unexpected arguments; 'func1' expects 1 positional arguments."
      
      def func2(arg, *, foo=1, bar=2):
          pass  # empty
      
      func2(1, 2)  # False negative
      

      The number of mandatory positional arguments does not change and the number of provided positional arguments is always the same. The only thing changing are keyword only arguments. Keyword only arguments should not impact positional arguments.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                pierre-yves.nicolas Pierre-Yves Nicolas
                Reporter:
                nicolas.harraudeau Nicolas Harraudeau
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved: