Skip to main content

flake8-x-quotes - fork of flake8-x-quotes with an update for f-strings

Major update from flake8-quotes 2.0.0

We automatically encourage avoiding escaping quotes as per PEP 8. To disable this, use --no-avoid-escape (can be used in configuration file via avoid-escape).

Deprecated option removed from this fork of flake8-quotes

  • --quotes - now renamed to --inline-quotes.

Usage

If you are using flake8 it’s as easy as:

pip install flake8-x-quotes

Now you don’t need to worry about people like @sectioneight constantly complaining that you are using double-quotes and not single-quotes.

Warnings

This package adds flake8 warnings with the prefix Q0. You might want to enable this warning inside your flake8 configuration file. Typically that will be .flake8 inside the root folder of your project.

select = Q0

The current set of warnings is:

Code

Description

Q000

Remove bad quotes

Q001

Remove bad quotes from multiline string

Q002

Remove bad quotes from docstring

Q003

Change outer quotes to avoid escaping inner quotes

Q099

[flake8-x-quotes] Remove bad quotes from f-string - CODE IS SUBJECT TO CHANGE

Configuration

By default, we expect single quotes (’) and look for unwanted double quotes (”) (other way around for f-string quotes, multiline quotes, and docstring quotes). To expect double quotes (”) and find unwanted single quotes (‘), use the CLI option:

flake8 --inline-quotes '"'
# We also support "double" and "single"
# flake8 --inline-quotes 'double'
#
# We also support configuration for multiline quotes
# flake8 --inline-quotes '"' --multiline-quotes "'"
# We also support "'''"
# flake8 --inline-quotes '"' --multiline-quotes "'''"
#
# We also support docstring quotes similarly
# flake8 --inline-quotes '"' --docstring-quotes "'"
# flake8 --inline-quotes '"' --docstring-quotes "'''"

# We also support disabling escaping quotes
# flake8 --no-avoid-escape

# [flake8-x-quotes] configure for f-string vs normal string literal:
flake8 --inline-quotes 'double' --f-string-quotes 'single'

or configuration option in tox.ini/setup.cfg.

[flake8]
inline-quotes = "
# We also support "double" and "single"
# inline-quotes = double
#
# We also support configuration for multiline quotes
# multiline-quotes = '
# We also support "'''"
# multiline-quotes = '''
#
# We also support docstring quotes similarly
# docstring-quotes = '
# docstring-quotes = '''
#
# We also support disabling escaping quotes
# avoid-escape = False
#
# [flake8-x-quotes] configure for f-string vs normal string literal:
# inline-quotes = double
# f-string-quotes = single

Supported Python versions

Caveats

We follow the PEP8 conventions to avoid backslashes in the string. So, no matter what configuration you are using (single or double quotes) these are always valid strings

s = 'double "quotes" wrapped in singles are ignored'
s = "single 'quotes' wrapped in doubles are ignored"

Metadata

Release files for flake8-x-quotes 0.0.2

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-x-quotes 0.0.2
File Size Uploaded
flake8-x-quotes-0.0.2.tar.gz 13.9 kB Details

Release files / flake8-x-quotes-0.0.2.tar.gz

Download URL flake8-x-quotes-0.0.2.tar.gz
Size 13.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a684b277978063f902403e07d961efb0e3eae73532215c561a00c8c4b13a9d84
BLAKE2b-256 checksum
How to use checksums
8c7da8882bf51e9890cd159cdb064e96776d46bdeeafa450cb74746059d0e440
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

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