Flake8 Extension to lint for quotes.
===========================================
.. image:: https://travis-ci.org/zheller/flake8-quotes.svg?branch=master
:target: https://travis-ci.org/zheller/flake8-quotes
:alt: Build Status
Major update in 2.0.0
---------------------
We automatically encourage avoiding escaping quotes as per `PEP 8 <https://www.python.org/dev/peps/pep-0008/#string-quotes>`_. To disable this, use ``--no-avoid-escape`` (can be used in configuration file via ``avoid-escape``).
Deprecation notice in 0.3.0
---------------------------
To anticipate multiline support, we are renaming ``--quotes`` to ``--inline-quotes``. Please adjust your configurations appropriately.
Usage
-----
If you are using flake8 it's as easy as:
.. code:: shell
pip install flake8-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.
.. code:: ini
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
==== =========================================================================
Configuration
-------------
By default, we expect single quotes (') and look for unwanted double quotes ("). To expect double quotes (") and find unwanted single quotes ('), use the CLI option:
.. code:: shell
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
or configuration option in `tox.ini`/`setup.cfg`.
.. code:: ini
[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
Caveats
-------
We follow the `PEP8 conventions <https://www.python.org/dev/peps/pep-0008/#string-quotes>`_ to avoid backslashes in the string. So, no matter what configuration you are using (single or double quotes) these are always valid strings
.. code:: python
s = 'double "quotes" wrapped in singles are ignored'
s = "single 'quotes' wrapped in doubles are ignored"
Raw data
{
"_id": null,
"home_page": "http://github.com/zheller/flake8-quotes/",
"name": "flake8-quotes",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "flake8 lint quotes",
"author": "Zachary Wright Heller",
"author_email": "zheller@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/dd/57/a173e3eb86072b7ee77650aca496b15d6886367d257f58ea9de5276e330a/flake8-quotes-3.4.0.tar.gz",
"platform": null,
"description": "Flake8 Extension to lint for quotes.\n===========================================\n\n.. image:: https://travis-ci.org/zheller/flake8-quotes.svg?branch=master\n :target: https://travis-ci.org/zheller/flake8-quotes\n :alt: Build Status\n\nMajor update in 2.0.0\n---------------------\nWe automatically encourage avoiding escaping quotes as per `PEP 8 <https://www.python.org/dev/peps/pep-0008/#string-quotes>`_. To disable this, use ``--no-avoid-escape`` (can be used in configuration file via ``avoid-escape``).\n\nDeprecation notice in 0.3.0\n---------------------------\nTo anticipate multiline support, we are renaming ``--quotes`` to ``--inline-quotes``. Please adjust your configurations appropriately.\n\nUsage\n-----\n\nIf you are using flake8 it's as easy as:\n\n.. code:: shell\n\n pip install flake8-quotes\n\nNow you don't need to worry about people like @sectioneight constantly\ncomplaining that you are using double-quotes and not single-quotes.\n\nWarnings\n--------\n\nThis package adds flake8 warnings with the prefix ``Q0``. You might want to\nenable this warning inside your flake8 configuration file. Typically that\nwill be ``.flake8`` inside the root folder of your project.\n\n.. code:: ini\n\n select = Q0\n\nThe current set of warnings is:\n\n==== =========================================================================\nCode Description\n---- -------------------------------------------------------------------------\nQ000 Remove bad quotes\nQ001 Remove bad quotes from multiline string\nQ002 Remove bad quotes from docstring\nQ003 Change outer quotes to avoid escaping inner quotes\n==== =========================================================================\n\nConfiguration\n-------------\n\nBy default, we expect single quotes (') and look for unwanted double quotes (\"). To expect double quotes (\") and find unwanted single quotes ('), use the CLI option:\n\n.. code:: shell\n\n flake8 --inline-quotes '\"'\n # We also support \"double\" and \"single\"\n # flake8 --inline-quotes 'double'\n #\n # We also support configuration for multiline quotes\n # flake8 --inline-quotes '\"' --multiline-quotes \"'\"\n # We also support \"'''\"\n # flake8 --inline-quotes '\"' --multiline-quotes \"'''\"\n #\n # We also support docstring quotes similarly\n # flake8 --inline-quotes '\"' --docstring-quotes \"'\"\n # flake8 --inline-quotes '\"' --docstring-quotes \"'''\"\n\n # We also support disabling escaping quotes\n # flake8 --no-avoid-escape\n\nor configuration option in `tox.ini`/`setup.cfg`.\n\n.. code:: ini\n\n [flake8]\n inline-quotes = \"\n # We also support \"double\" and \"single\"\n # inline-quotes = double\n #\n # We also support configuration for multiline quotes\n # multiline-quotes = '\n # We also support \"'''\"\n # multiline-quotes = '''\n #\n # We also support docstring quotes similarly\n # docstring-quotes = '\n # docstring-quotes = '''\n #\n # We also support disabling escaping quotes\n # avoid-escape = False\n\nCaveats\n-------\n\nWe follow the `PEP8 conventions <https://www.python.org/dev/peps/pep-0008/#string-quotes>`_ to avoid backslashes in the string. So, no matter what configuration you are using (single or double quotes) these are always valid strings\n\n.. code:: python\n\n s = 'double \"quotes\" wrapped in singles are ignored'\n s = \"single 'quotes' wrapped in doubles are ignored\"\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Flake8 lint for quotes.",
"version": "3.4.0",
"project_urls": {
"Homepage": "http://github.com/zheller/flake8-quotes/"
},
"split_keywords": [
"flake8",
"lint",
"quotes"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "dd57a173e3eb86072b7ee77650aca496b15d6886367d257f58ea9de5276e330a",
"md5": "b28fe312a62a84264d7c7659fd01e59c",
"sha256": "aad8492fb710a2d3eabe68c5f86a1428de650c8484127e14c43d0504ba30276c"
},
"downloads": -1,
"filename": "flake8-quotes-3.4.0.tar.gz",
"has_sig": false,
"md5_digest": "b28fe312a62a84264d7c7659fd01e59c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 14107,
"upload_time": "2024-02-10T21:58:22",
"upload_time_iso_8601": "2024-02-10T21:58:22.357389Z",
"url": "https://files.pythonhosted.org/packages/dd/57/a173e3eb86072b7ee77650aca496b15d6886367d257f58ea9de5276e330a/flake8-quotes-3.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-10 21:58:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zheller",
"github_project": "flake8-quotes",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "flake8-quotes"
}