Skip to main content
Build Status Coverage Status Pypi Entry

An extension for Flake8 to check the strings and parameters using str.format. It checks all strings whether they use numbered parameters with an implicit index which isn’t support in Python 2.6.

In all instances of '…'.format(…) it will also check whether there are enough parameters given. If the format call uses variable arguments, it’ll just check whether the right types of arguments are present.

Plugin for Flake8

When both Flake8 and flake8-string-format are installed, the plugin is available in flake8:

$ flake8 --version
3.0.2 (flake8-string-format: 0.2.3, […]

This plugin supports Flake8 2.6 as well as Flake8 3.0. Older or newer versions may be supported too but they weren’t tested.

Via --ignore it’s possible to ignore unindexed parameters:

$ flake8 some_file.py
...
some_file.py:1:1: FMT101 format string does contain unindexed parameters

$ flake8 --ignore FMT101 some_file.py
...

Parameters

This module doesn’t add any additional parameters to Flake8.

Error codes

This plugin is using the following error codes:

Presence of implicit parameters

FMT101

format string contains unindexed parameters

FMT102

docstring contains unindexed parameters

FMT103

other string contains unindexed parameters

Missing values in the parameters

FMT201

format call index too large (INDEX)

FMT202

format call uses missing keyword (KEYWORD)

FMT203

format call uses keyword arguments but there are no keyword entries

FMT204

format call uses indexed arguments but there are no indexed entries

FMT205

format call uses implicit and explicit indexes together

Unused values in the parameters

FMT301

format call provides unused index (INDEX)

FMT302

format call provides unused keyword (KEYWORD)

Operation

The plugin will go through all bytes, str and unicode instances. If it encounters bytes instances on Python 3, it’ll decode them using ASCII and if that fails it’ll skip that entry.

Depending on the usage the string is handled differently. When it is not being formatted, it can only cause FMT102 and FMT103. For this plugin all strings which are the first expression of the module or after a function or class definition are considered docstrings.

Both FMT102 and FMT103 issue many false positives and should only be used with Python 2.6 which does not support unindexed parameters.

Format strings

Every string where either the format method is called or where it is the first parameter of str.format, is considered a format string and cause the higher numbers.

If that call to format uses variable arguments, it cannot issue FMT201 and FMT202 as missing entries might be hidden in those variable arguments. FMT301 and FMT302 can still be checked for any argument which is defined statically.

Python 2.6 support

Python 2.6 is only partially supported as it’s using Python’s capability to format a string. So if a string contains implicit parameters, it won’t be detected as a parameter on Python 2.6 and thus it won’t cause any FMT1XX errors. But it might still cause an error FMT301 when variable arguments aren’t used.

So if Python 2.6 compatibility is wished and thus implicit parameters aren’t allowed, this plugin won’t cause false positives.

Changes

0.4.0 - 2026-06-09

  • Fix support for Python version 3.14

  • Improve error message wording

0.3.0 - 2020-02-16

  • Removed support for standalone version.

  • Support multiple starargs and at any location.

0.2.3 - 2016-07-27

  • Properly register with Flake8 so it will be selected on Flake8 3.x by default and it can be selected on Flake8 2.x.

0.2.2 - 2016-05-29

  • Do not check simple expressions, except for docstrings, because they cannot be accessed anyway.

  • Properly assert starred arguments in Python 3.5. Only the last element must be a vararg if varargs are present and not the complete list.

  • Output correct column offset on Python 3.4.2, as that used the wrong offset inside calls.

0.2.1 - 2015-09-20

  • Support str.format("…", …) calls and handle them like "…".format(…)

0.2.0 - 2015-09-12

  • Instead of using a regex it’s trying to parse it using Python’s parser

  • This result can also be used now to verify that enough parameters are given

  • Limited Python 2.6 support

0.1.0 - 2015-09-10

  • Detect unindexed parameters in all strings

  • Separate error code for docstrings

Release files for flake8-string-format 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-string-format 0.4.0
File Size Uploaded
flake8_string_format-0.4.0.tar.gz 11.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8-string-format 0.4.0
File Interpreter ABI Platform
flake8_string_format-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.0 kB

Release files / flake8_string_format-0.4.0.tar.gz

Download URL flake8_string_format-0.4.0.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
817431aeed09a9cad28099425b5a2a03d58c10e9460dcf8475d7f923ac10f26a
BLAKE2b-256 checksum
How to use checksums
336d77518ea592397565bd2dd00bd3448a870245e4ae50671e214e0965329156
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.

Transparency log

Release files / flake8_string_format-0.4.0-py3-none-any.whl

Download URL flake8_string_format-0.4.0-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
650f4d1167a393179fbc62074c523111136b3797281a44f5715b69a560ed82b6
BLAKE2b-256 checksum
How to use checksums
29846c3f164f52444e23495f0a7d57378906a2447c715121c1bccda3a975c608
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page