Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
.. image:: https://travis-ci.org/zheller/flake8-quotes.svg?branch=master :target: https://travis-ci.org/zheller/flake8-quotes :alt: Build Status
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
).
To anticipate multiline support, we are renaming --quotes
to --inline-quotes
. Please adjust your configurations appropriately.
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.
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 ==== =========================================================================
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
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"
FAQs
Flake8 lint for quotes.
We found that flake8-quotes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.