CodeQL documentation

Unsupported format character

ID: py/percent-format/unsupported-character
Kind: problem
Security severity: 
Severity: error
Precision: high
Tags:
   - quality
   - reliability
   - correctness
Query suites:
   - python-security-and-quality.qls

Click to see the query in the CodeQL repository

A format string, that is the string on the left hand side of an expression like fmt % arguments, must consist of legal conversion specifiers. Otherwise, a ValueError will be raised.

Recommendation

Choose a legal conversion specifier.

Example

In format_as_tuple_incorrect, “t” is not a legal conversion specifier.


def format_as_tuple_incorrect(args):
    return "%t" % args

def format_as_tuple_correct(args):
    return "%r" % (args,)

References

  • © GitHub, Inc.
  • Terms
  • Privacy
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy