Commit 202853b6 authored by Ondřej Nový's avatar Ondřej Nový

New upstream version 3.7.8

parent 58cb0919
Metadata-Version: 1.2
Name: flake8
Version: 3.6.0
Version: 3.7.8
Summary: the modular source code checker: pep8, pyflakes and co
Home-page: https://gitlab.com/pycqa/flake8
Author: Tarek Ziade
......@@ -29,7 +29,7 @@ Description: ========
- lines that contain a ``# noqa`` comment at the end will not issue warnings.
- you can ignore specific errors on a line with ``# noqa: <error>``, e.g.,
``# noqa: E234``
``# noqa: E234``. Multiple codes can be given, separated by comma. The ``noqa`` token is case insensitive, the colon before the list of codes is required otherwise the part after ``noqa`` is ignored
- Git and Mercurial hooks
- extendable through ``flake8.extension`` and ``flake8.formatting`` entry
points
......
......@@ -19,7 +19,7 @@ It also adds a few features:
- lines that contain a ``# noqa`` comment at the end will not issue warnings.
- you can ignore specific errors on a line with ``# noqa: <error>``, e.g.,
``# noqa: E234``
``# noqa: E234``. Multiple codes can be given, separated by comma. The ``noqa`` token is case insensitive, the colon before the list of codes is required otherwise the part after ``noqa`` is ignored
- Git and Mercurial hooks
- extendable through ``flake8.extension`` and ``flake8.formatting`` entry
points
......
......@@ -61,8 +61,6 @@ Utility Functions
.. autofunction:: flake8.processor.mutate_string
.. autofunction:: flake8.processor.token_is_comment
.. autofunction:: flake8.processor.token_is_newline
.. Substitutions
......
......@@ -165,6 +165,17 @@ Merge requests should:
- Follow the guidelines in :ref:`writing-code`
- Avoid having :code:`.gitignore` file in your PR
Changes to :code:`.gitignore` will rarely be accepted.
If you need to add files to :code:`.gitignore` you have multiple options
- Create a global :code:`.gitignore` file
- Create/update :code:`.git/info/exclude` file.
Both these options are explained in detail `here <https://help.github.com/en/articles/ignoring-files#create-a-global-gitignore>`_
Reviewing and Triaging Issues and Merge Requests
================================================
......
......@@ -4,15 +4,13 @@ Plugin Handling
Plugin Management
-----------------
|Flake8| 3.0 added support for two other plugins besides those which define
|Flake8| 3.0 added support for other plugins besides those which define
new checks. It now supports:
- extra checks
- alternative report formatters
- listeners to auto-correct violations of checks
To facilitate this, |Flake8| needed a more mature way of managing plugins.
Thus, we developed the |PluginManager| which accepts a namespace and will load
the plugins for that namespace. A |PluginManager| creates and manages many
......@@ -38,12 +36,10 @@ the |PTM| will subclass it and specify the ``namespace``, e.g.,
This provides a few extra methods via the |PluginManager|'s ``map`` method.
Finally, we create three classes of plugins:
Finally, we create two classes of plugins:
- :class:`~flake8.plugins.manager.Checkers`
- :class:`~flake8.plugins.manager.Listeners`
- :class:`~flake8.plugins.manager.ReportFormatters`
These are used to interact with each of the types of plugins individually.
......@@ -53,29 +49,6 @@ These are used to interact with each of the types of plugins individually.
Our inspiration for our plugin handling comes from the author's extensive
experience with ``stevedore``.
Notifying Listener Plugins
--------------------------
One of the interesting challenges with allowing plugins to be notified each
time an error or warning is emitted by a checker is finding listeners quickly
and efficiently. It makes sense to allow a listener to listen for a certain
class of warnings or just a specific warning. Hence, we need to allow all
plugins that listen to a specific warning or class to be notified. For
example, someone might register a listener for ``E1`` and another for ``E111``
if ``E111`` is triggered by the code, both listeners should be notified.
If ``E112`` is returned, then only ``E1`` (and any other listeners) would be
notified.
To implement this goal, we needed an object to store listeners in that would
allow for efficient look up - a Trie (or Prefix Tree). Given that none of the
existing packages on PyPI allowed for storing data on each node of the trie,
it was left up to write our own as :class:`~flake8.plugins._trie.Trie`. On
top of that we layer our :class:`~flake8.plugins.notifier.Notifier` class.
Now when |Flake8| receives an error or warning, we can easily call the
:meth:`~flake8.plugins.notifier.Notifier.notify` method and let plugins act on
that knowledge.
Default Plugins
---------------
......@@ -103,7 +76,7 @@ API Documentation
.. autoclass:: flake8.plugins.manager.PluginManager
:members:
:special-members: __init__, __contains__, __getitem__
:special-members: __init__
.. autoclass:: flake8.plugins.manager.Plugin
:members:
......@@ -115,15 +88,8 @@ API Documentation
.. autoclass:: flake8.plugins.manager.Checkers
:members:
.. autoclass:: flake8.plugins.manager.Listeners
:members: build_notifier
.. autoclass:: flake8.plugins.manager.ReportFormatters
.. autoclass:: flake8.plugins.notifier.Notifier
.. autoclass:: flake8.plugins._trie.Trie
.. |PluginManager| replace:: :class:`~flake8.plugins.manager.PluginManager`
.. |Plugin| replace:: :class:`~flake8.plugins.manager.Plugin`
.. |PTM| replace:: :class:`~flake8.plugins.manager.PluginTypeManager`
......@@ -51,7 +51,7 @@ path if the string has a ``/`` in it. It also removes trailing ``/``\ s.
.. autofunction:: flake8.utils.normalize_paths
This function utilizes :func:`~flake8.utils.parse_comma_separated_list` and
:func:`~flake8.utils.normalize_path` to normalize it's input to a list of
:func:`~flake8.utils.normalize_path` to normalize its input to a list of
strings that should be paths.
.. autofunction:: flake8.utils.stdin_get_value
......
......@@ -161,7 +161,7 @@ some plugins. |Flake8| 2.5 and earlier had started monkey-patching pep8's
monkey-patched that. 3.0 has its own internal implementation and uses that but
does not directly provide anything for plugins using pep8 and pycodestyle's
``stdin_get_value`` function. |polyfill| provides this functionality for
plugin developers via it's :mod:`flake8_polyfill.stdin` module.
plugin developers via its :mod:`flake8_polyfill.stdin` module.
If a plugin needs to read the content from stdin, it can do the following:
......
......@@ -48,6 +48,7 @@ the data instead of being called on each physical or logical line.
- :attr:`~flake8.processor.FileProcessor.file_tokens`
- :attr:`~flake8.processor.FileProcessor.lines`
- :attr:`~flake8.processor.FileProcessor.max_line_length`
- :attr:`~flake8.processor.FileProcessor.max_doc_length`
- :attr:`~flake8.processor.FileProcessor.total_lines`
- :attr:`~flake8.processor.FileProcessor.verbose`
......@@ -65,10 +66,10 @@ once per file. The parameters listed above can be combined with
Registering Options
===================
Any plugin that has callable attributes ``provide_options`` and
``register_options`` can parse option information and register new options.
Any plugin that has callable attributes ``add_options`` and
``parse_options`` can parse option information and register new options.
Your ``register_options`` function should expect to receive an instance of
Your ``add_options`` function should expect to receive an instance of
|OptionManager|. An |OptionManager| instance behaves very similarly to
:class:`optparse.OptionParser`. It, however, uses the layer that |Flake8| has
developed on top of :mod:`optparse` to also handle configuration file parsing.
......@@ -157,19 +158,19 @@ documentation of :mod:`optparse`.
Accessing Parsed Options
========================
When a plugin has a callable ``provide_options`` attribute, |Flake8| will call
When a plugin has a callable ``parse_options`` attribute, |Flake8| will call
it and attempt to provide the |OptionManager| instance, the parsed options
which will be an instance of :class:`optparse.Values`, and the extra arguments
that were not parsed by the |OptionManager|. If that fails, we will just pass
the :class:`optparse.Values`. In other words, your ``provide_options``
the :class:`optparse.Values`. In other words, your ``parse_options``
callable will have one of the following signatures:
.. code-block:: python
def provide_options(option_manager, options, args):
def parse_options(option_manager, options, args):
pass
# or
def provide_options(options):
def parse_options(options):
pass
.. substitutions
......
......@@ -86,13 +86,10 @@ grouping of entry-points that flake8 should look in.
- ``flake8.extension``
- ``flake8.listen``
- ``flake8.report``
If your plugin is one that adds checks to |Flake8|, you will use
``flake8.extension``. If your plugin automatically fixes errors in code, you
will use ``flake8.listen``. Finally, if your plugin performs extra report
``flake8.extension``. If your plugin performs extra report
handling (formatting, filtering, etc.) it will use ``flake8.report``.
If our ``ExamplePlugin`` is something that adds checks, our code would look
......@@ -114,17 +111,17 @@ The ``X`` in checking plugins define what error codes it is going to report.
So if the plugin reports only the error code ``X101`` your entry-point would
look like::
X101 = flake8_example.ExamplePlugin
X101 = flake8_example:ExamplePlugin
If your plugin reports several error codes that all start with ``X10``, then
it would look like::
X10 = flake8_example.ExamplePlugin
X10 = flake8_example:ExamplePlugin
If all of your plugin's error codes start with ``X1`` then it would look
like::
X1 = flake8_example.ExamplePlugin
X1 = flake8_example:ExamplePlugin
Finally, if all of your plugin's error codes start with just ``X`` then it
would look like the original example.
......
......@@ -33,7 +33,7 @@ Features
also `GitLab#405`_, `GitLab!227`_)
- Add ``--extend-ignore`` for extending the default ``ignore`` instead of
overriding it (See also `GitLab!233`_)
overriding it (See also `GitLab#365`_, `GitLab!233`_)
Bugs Fixed
~~~~~~~~~~
......@@ -50,7 +50,7 @@ Bugs Fixed
``collections`` module (See also `GitLab!249`_)
- Defer ``setuptools`` import to improve flake8 startup time (See also
`GitLab#365`_, `GitLab!250`_)
`GitLab!250`_)
- Fix inconsistent line endings in ``FileProcessor.lines`` when running under
python 3.x (See also `GitLab#457`_, `GitLab!255`_)
......
3.7.0 -- 2019-01-29
-------------------
You can view the `3.7.0 milestone`_ on GitLab for more details.
New Dependency Information
~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add dependency on ``entrypoints`` >= 0.3, < 0.4 (See also `GitLab!264`_,
`GitLab!288`_)
- Pyflakes has been updated to >= 2.1.0, < 2.2.0 (See also `GitLab!283`_,
`GitLab!285`_)
- pycodestyle has been updated to >= 2.5.0, < 2.6.0 (See also `GitLab!287`_)
Features
~~~~~~~~
- Add support for ``per-file-ignores`` (See also `GitLab!259`_, `GitLab#156`_,
`GitLab!281`_, `GitLab#471`_)
- Enable use of ``float`` and ``complex`` option types (See also `GitLab!261`_,
`GitLab#452`_)
- Improve startup performance by switching from ``pkg_resources`` to
``entrypoints`` (See also `GitLab!264`_)
- Add metadata for use through the `pre-commit`_ git hooks framework (See also
`GitLab!268`_, `GitLab!284`_)
- Allow physical line checks to return more than one result (See also
`GitLab!269`_)
- Allow ``# noqa:X123`` comments without space between the colon and codes
list (See also `GitLab!273`_, `GitLab#470`_)
- Remove broken and unused ``flake8.listen`` plugin type (See also
`GitLab!274`_, `GitLab#480`_)
.. all links
.. _3.7.0 milestone:
https://gitlab.com/pycqa/flake8/milestones/23
.. _pre-commit:
https://pre-commit.com/
.. issue links
.. _GitLab#156:
https://gitlab.com/pycqa/flake8/issues/156
.. _GitLab#452:
https://gitlab.com/pycqa/flake8/issues/452
.. _GitLab#470:
https://gitlab.com/pycqa/flake8/issues/470
.. _GitLab#471:
https://gitlab.com/pycqa/flake8/issues/471
.. _GitLab#480:
https://gitlab.com/pycqa/flake8/issues/480
.. merge request links
.. _GitLab!259:
https://gitlab.com/pycqa/flake8/merge_requests/259
.. _GitLab!261:
https://gitlab.com/pycqa/flake8/merge_requests/261
.. _GitLab!264:
https://gitlab.com/pycqa/flake8/merge_requests/264
.. _GitLab!268:
https://gitlab.com/pycqa/flake8/merge_requests/268
.. _GitLab!269:
https://gitlab.com/pycqa/flake8/merge_requests/269
.. _GitLab!273:
https://gitlab.com/pycqa/flake8/merge_requests/273
.. _GitLab!274:
https://gitlab.com/pycqa/flake8/merge_requests/274
.. _GitLab!281:
https://gitlab.com/pycqa/flake8/merge_requests/281
.. _GitLab!283:
https://gitlab.com/pycqa/flake8/merge_requests/283
.. _GitLab!284:
https://gitlab.com/pycqa/flake8/merge_requests/284
.. _GitLab!285:
https://gitlab.com/pycqa/flake8/merge_requests/285
.. _GitLab!287:
https://gitlab.com/pycqa/flake8/merge_requests/287
.. _GitLab!288:
https://gitlab.com/pycqa/flake8/merge_requests/288
3.7.1 -- 2019-01-30
-------------------
You can view the `3.7.1 milestone`_ on GitLab for more details.
Bugs Fixed
~~~~~~~~~~
- Fix capitalized filenames in ``per-file-ignores`` setting (See also
`GitLab!290`_, `GitLab#488`_)
.. all links
.. _3.7.1 milestone:
https://gitlab.com/pycqa/flake8/milestones/24
.. issue links
.. _GitLab#488:
https://gitlab.com/pycqa/flake8/issues/488
.. merge request links
.. _GitLab!290:
https://gitlab.com/pycqa/flake8/merge_requests/290
3.7.2 -- 2019-01-30
-------------------
You can view the `3.7.2 milestone`_ on GitLab for more details.
Bugs Fixed
~~~~~~~~~~
- Fix broken ``flake8 --diff`` (regressed in 3.7.0) (See also `GitLab!292`_,
`GitLab#490`_)
- Fix typo in plugin exception reporting (See also `GitLab!275`_,
`GitLab#491`_)
- Fix ``AttributeError`` while attempting to use the legacy api (regressed in
3.7.0) (See also `GitLab!293`_, `GitLab#497`_)
.. all links
.. _3.7.2 milestone:
https://gitlab.com/pycqa/flake8/milestones/25
.. issue links
.. _GitLab#490:
https://gitlab.com/pycqa/flake8/issues/490
.. _GitLab#491:
https://gitlab.com/pycqa/flake8/issues/491
.. _GitLab#497:
https://gitlab.com/pycqa/flake8/issues/497
.. merge request links
.. _GitLab!292:
https://gitlab.com/pycqa/flake8/merge_requests/292
.. _GitLab!275:
https://gitlab.com/pycqa/flake8/merge_requests/275
.. _GitLab!293:
https://gitlab.com/pycqa/flake8/merge_requests/293
3.7.3 -- 2019-01-30
-------------------
You can view the `3.7.3 milestone`_ on GitLab for more details.
Bugs Fixed
~~~~~~~~~~
- Fix imports of ``typing`` in python 3.5.0 / 3.5.1 (See also `GitLab!294`_,
`GitLab#498`_)
- Fix ``flake8 --statistics`` (See also `GitLab!295`_, `GitLab#499`_)
- Gracefully ignore ``flake8-per-file-ignores`` plugin if installed (See also
`GitLab!297`_, `GitLab#495`_)
- Improve error message for malformed ``per-file-ignores`` (See also
`GitLab!298`_, `GitLab#489`_)
.. all links
.. _3.7.3 milestone:
https://gitlab.com/pycqa/flake8/milestones/26
.. issue links
.. _GitLab#489:
https://gitlab.com/pycqa/flake8/issues/489
.. _GitLab#495:
https://gitlab.com/pycqa/flake8/issues/495
.. _GitLab#498:
https://gitlab.com/pycqa/flake8/issues/498
.. _GitLab#499:
https://gitlab.com/pycqa/flake8/issues/499
.. merge request links
.. _GitLab!294:
https://gitlab.com/pycqa/flake8/merge_requests/294
.. _GitLab!295:
https://gitlab.com/pycqa/flake8/merge_requests/295
.. _GitLab!297:
https://gitlab.com/pycqa/flake8/merge_requests/297
.. _GitLab!298:
https://gitlab.com/pycqa/flake8/merge_requests/298
3.7.4 -- 2019-01-31
-------------------
You can view the `3.7.4 milestone`_ on GitLab for more details.
Bugs Fixed
~~~~~~~~~~
- Fix performance regression with lots of ``per-file-ignores`` and errors
(See also `GitLab!299`_, `GitLab#501`_)
.. all links
.. _3.7.4 milestone:
https://gitlab.com/pycqa/flake8/milestones/27
.. issue links
.. _GitLab#501:
https://gitlab.com/pycqa/flake8/issues/501
.. merge request links
.. _GitLab!299:
https://gitlab.com/pycqa/flake8/merge_requests/299
3.7.5 -- 2019-02-04
-------------------
You can view the `3.7.5 milestone`_ on GitLab for more details.
Bugs Fixed
~~~~~~~~~~
- Fix reporting of pyflakes "referenced before assignment" error (See also
`GitLab!301`_, `GitLab#503`_)
.. all links
.. _3.7.5 milestone:
https://gitlab.com/pycqa/flake8/milestones/28
.. issue links
.. _GitLab#503:
https://gitlab.com/pycqa/flake8/issues/503
.. merge request links
.. _GitLab!301:
https://gitlab.com/pycqa/flake8/merge_requests/301
3.7.6 -- 2019-02-18
-------------------
You can view the `3.7.6 milestone`_ on GitLab for more details.
Bugs Fixed
~~~~~~~~~~
- Fix ``--per-file-ignores`` for multi-letter error codes (See also
`GitLab!303`_, `GitLab#507`_)
- Improve flake8 speed when only 1 filename is passed (See also `GitLab!305`_)
.. all links
.. _3.7.6 milestone:
https://gitlab.com/pycqa/flake8/milestones/29
.. issue links
.. _GitLab#507:
https://gitlab.com/pycqa/flake8/issues/507
.. merge request links
.. _GitLab!303:
https://gitlab.com/pycqa/flake8/merge_requests/303
.. _GitLab!305:
https://gitlab.com/pycqa/flake8/merge_requests/305
3.7.7 -- 2019-02-25
-------------------
You can view the `3.7.7 milestone`_ on GitLab for more details.
Bugs Fixed
~~~~~~~~~~
- Fix crahes in plugins causing ``flake8`` to hang while unpickling errors (See
also `GitLab!308`_, `GitLab#505`_)
.. all links
.. _3.7.7 milestone:
https://gitlab.com/pycqa/flake8/milestones/30
.. issue links
.. _GitLab#505:
https://gitlab.com/pycqa/flake8/issues/505
.. merge request links
.. _GitLab!308:
https://gitlab.com/pycqa/flake8/merge_requests/308
3.7.8 -- 2019-07-08
-------------------
You can view the `3.7.8 milestone`_ on GitLab for more details.
Bugs Fixed
~~~~~~~~~~
- Fix handling of ``Application.parse_preliminary_options_and_args`` when
argv is an empty list (See also `GitLab!310`_, `GitLab#518`_)
- Fix crash when a file parses but fails to tokenize (See also `GitLab!314`_,
`GitLab#532`_)
- Log the full traceback on plugin exceptions (See also `GitLab!317`_)
- Fix ``# noqa: ...`` comments with multi-letter codes (See also `GitLab!326`_,
`GitLab#549`_)
.. all links
.. _3.7.8 milestone:
https://gitlab.com/pycqa/flake8/milestones/31
.. issue links
.. _GitLab#518:
https://gitlab.com/pycqa/flake8/issues/518
.. _GitLab#532:
https://gitlab.com/pycqa/flake8/issues/532
.. _GitLab#549:
https://gitlab.com/pycqa/flake8/issues/549
.. merge request links
.. _GitLab!310:
https://gitlab.com/pycqa/flake8/merge_requests/310
.. _GitLab!314:
https://gitlab.com/pycqa/flake8/merge_requests/314
.. _GitLab!317:
https://gitlab.com/pycqa/flake8/merge_requests/317
.. _GitLab!326:
https://gitlab.com/pycqa/flake8/merge_requests/326
......@@ -9,6 +9,15 @@ with the newest releases first.
==================
.. toctree::
3.7.8
3.7.7
3.7.6
3.7.5
3.7.4
3.7.3
3.7.2
3.7.1
3.7.0
3.6.0
3.5.0
3.4.1
......
......@@ -39,6 +39,10 @@ generates its own :term:`error code`\ s for ``pyflakes``:
+------+---------------------------------------------------------------------+
| F631 | assertion test is a tuple, which are always ``True`` |
+------+---------------------------------------------------------------------+
| F632 | use ``==/!=`` to compare ``str``, ``bytes``, and ``int`` literals |
+------+---------------------------------------------------------------------+
| F633 | assertion test is a tuple, which are always ``True`` |
+------+---------------------------------------------------------------------+
+------+---------------------------------------------------------------------+
| F701 | a ``break`` statement outside of a ``while`` or ``for`` loop |
+------+---------------------------------------------------------------------+
......@@ -54,8 +58,11 @@ generates its own :term:`error code`\ s for ``pyflakes``:
+------+---------------------------------------------------------------------+
| F707 | an ``except:`` block as not the last exception handler |
+------+---------------------------------------------------------------------+
| F721 | doctest syntax error |
| F722 | syntax error in forward type annotation |
| F721 | syntax error in doctest |
+------+---------------------------------------------------------------------+
| F722 | syntax error in forward annotation |
+------+---------------------------------------------------------------------+
| F723 | syntax error in type comment |
+------+---------------------------------------------------------------------+
+------+---------------------------------------------------------------------+
| F811 | redefinition of unused ``name`` from line ``N`` |
......
......@@ -58,8 +58,12 @@ Index of Options
- :option:`flake8 --extend-ignore`
- :option:`flake8 --per-file-ignores`
- :option:`flake8 --max-line-length`
- :option:`flake8 --max-doc-length`
- :option:`flake8 --select`
- :option:`flake8 --disable-noqa`
......@@ -397,7 +401,7 @@ Options and their Descriptions
need only specify ``W23`` to ignore them. This also works for ``W2`` and
``W`` (for example).
This defaults to: ``E121,E123,E126,E226,E24,E704``
This defaults to: ``E121,E123,E126,E226,E24,E704,W503,W504``
Command-line example:
......@@ -422,6 +426,8 @@ Options and their Descriptions
:ref:`Go back to index <top>`
.. versionadded:: 3.6.0
Specify a list of codes to add to the list of ignored ones. Similar
considerations as in :option:`--ignore` apply here with regard to the
value.
......@@ -449,6 +455,40 @@ Options and their Descriptions
extend-ignore = E4,E51,W234
.. option:: --per-file-ignores=<filename:errors>[ <filename:errors>]
:ref:`Go back to index <top>`
.. versionadded:: 3.7.0
Specify a list of mappings of files and the codes that should be ignored
for the entirety of the file. This allows for a project to have a default
list of violations that should be ignored as well as file-specific
violations for files that have not been made compliant with the project
rules.
This option supports syntax similar to :option:`--exclude` such that glob
patterns will also work here.
This can be combined with both :option:`--ignore` and
:option:`--extend-ignore` to achieve a full flexibility of style options.
Command-line usage:
.. prompt:: bash
flake8 --per-file-ignores='project/__init__.py:F401 setup.py:E121'
flake8 --per-file-ignores='project/*/__init__.py:F401 setup.py:E121'
This **can** be specified in config files.
.. code-block:: ini
per-file-ignores =
project/__init__.py:F401
setup.py:E121
other_project/*:W9
.. option:: --max-line-length=<n>
:ref:`Go back to index <top>`
......@@ -482,6 +522,28 @@ Options and their Descriptions
max-line-length = 79
.. option:: --max-doc-length=<n>
:ref:`Go back to index <top>`
Set the maximum length that a comment or docstring line may be.
By default, there is no limit on documentation line length.
Command-line example:
.. prompt:: bash
flake8 --max-doc-length 99 dir/
This **can** be specified in config files.
Example config file usage:
.. code-block:: ini
max-doc-length = 79
.. option:: --select=<errors>
......@@ -743,6 +805,8 @@ Options and their Descriptions
:ref:`Go back to index <top>`
.. versionadded:: 3.6.0