GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • CodeQL documentation
  • CodeQL overview
  • Writing CodeQL queries
  • CodeQL language guides
  • QL language reference
  • CodeQL standard-libraries
  • CodeQL query help
  • CodeQL repository
  • QL publications
  • CodeQL query help for C and C++
  • CodeQL query help for C#
  • CodeQL query help for GitHub Actions
  • CodeQL query help for Go
  • CodeQL query help for Java and Kotlin

This view

  • Original page
  • New address

GeezerVison is showing codeql.github.com — Wrong number of arguments in a call — CodeQL query help documentation

Wrong number of arguments in a call¶

ID: py/call/wrong-arguments
Kind: problem
Security severity: 
Severity: error
Precision: very-high
Tags:
   - quality
   - reliability
   - correctness
   - external/cwe/cwe-685
Query suites:
   - python-code-quality.qls
   - python-security-and-quality.qls

Click to see the query in the CodeQL repository

A function call must supply an argument for each parameter that does not have a default value defined, so:

  • The minimum number of arguments is the number of parameters without default values.

  • The maximum number of arguments is the total number of parameters, unless the function takes a varargs (starred) parameter in which case there is no limit.

Recommendation¶

If there are too few arguments then check to see which arguments have been omitted and supply values for those.

If there are too many arguments then check to see if any have been added by mistake and remove those.

Also check where a comma has been inserted instead of an operator or a dot. For example, the code is obj,attr when it should be obj.attr.

If it is not clear which are the missing or surplus arguments, then this suggests a logical error. The fix will then depend on the nature of the error.

References¶

  • Python Glossary: Arguments.

  • Python Glossary: Parameters.

  • Python Programming FAQ: What is the difference between arguments and parameters?.

  • Common Weakness Enumeration: CWE-685.

  • © GitHub, Inc.
  • Terms
  • Privacy
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.