forked from github/codeql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnusedArgumentIn3101Format.qhelp
More file actions
33 lines (27 loc) · 1.04 KB
/
UnusedArgumentIn3101Format.qhelp
File metadata and controls
33 lines (27 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<!DOCTYPE qhelp PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<qhelp>
<overview>
<p>A formatting expression, that is an expression of the form <code>the_format.format(args)</code> or <code>format(the_format, args)</code>,
can have any number of arguments, provided that there are enough to match the format.
However, surplus arguments are redundant and clutter the code, making it harder to read.
</p>
<p>
It is also possible that surplus arguments indicate a mistake in the format string.
</p>
</overview>
<recommendation>
<p>
Check that the format string is correct and then remove any surplus arguments.
</p>
</recommendation>
<example>
<p>In the following example there are three arguments for the call to the <code>str.format()</code> method, but the format string only requires two.
The third argument should be deleted.</p>
<sample src="UnusedArgumentIn3101Format.py" />
</example>
<references>
<li>Python Library Reference: <a href="https://docs.python.org/2/library/string.html#string-formatting">String Formatting.</a> </li>
</references>
</qhelp>