github / github/codeql

LGTM.com - false positive - Python: Wrong number of arguments for format

Open
#3,970 2 comments 0 reactions 0 assignees View on GitHub
false-positive Python
Dominant language
CodeQL
Stars
10.1k
Forks
2.1k
Avg merge
2d 15h
Merged PRs (30d)
141

Description

**Description of the false positive**

In multiple places, constructs such as `var = '[0:%s]' % (cols)` and `print("\n%d files:" % len(filenames))` raise alert of type [Wrong number of arguments for format](https://lgtm.com/rules/2970098/).

I believe this may be caused by an incorrect interpretation of the parens where `(5)` is considered to be a singleton tuple whereas it should be `(5,)` however I am not sure if this is it.

**URL to the alert on the project page on LGTM.com**

https://lgtm.com/projects/g/JetBrains/intellij-community/snapshot/4142f5da479541c769625ab66eeadcbb03e4211b/files/python/helpers/pydev/_pydevd_bundle/pydevd_vars.py?sort=name&dir=ASC&mode=heatmap#xc5d0fd0dff6372d9:1

https://lgtm.com/projects/g/JetBrains/intellij-community/snapshot/4142f5da479541c769625ab66eeadcbb03e4211b/files/python/helpers/pydev/_pydevd_bundle/pydevd_comm.py#xa38757d85e31d8b0:1

https://lgtm.com/projects/g/JetBrains/intellij-community/snapshot/4142f5da479541c769625ab66eeadcbb03e4211b/files/python/helpers/coveragepy/coverage/cmdline.py#xa8bd8b0e65e16629:1

@RasmusSemmle @RasmusWL

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.