mirror of
https://github.com/PyCQA/flake8.git
synced 2026-03-30 02:46:52 +00:00
Adding docs for off by default
This adds documentation for the off_by_default option for extensions, which was added in MR !14. Signed-off-by: Jason Myers <jason@jasonamyers.com>
This commit is contained in:
parent
b50c510970
commit
a08a65b982
1 changed files with 20 additions and 1 deletions
|
|
@ -103,6 +103,25 @@ flake8 registers the extension:
|
|||
Since that is the defined entry point in the above ``setup.py``, flake8 finds
|
||||
it and uses it to register the extension.
|
||||
|
||||
If we wanted the extension or a check to be optional, you can add
|
||||
``off_by_default = True`` to our entry point. For example, we could
|
||||
update ``mccabe.py`` with this variable as shown below:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# https://github.com/flintwork/mccabe/blob/0.2/mccabe.py#L225:L254
|
||||
class McCabeChecker(object):
|
||||
"""McCabe cyclomatic complexity checker."""
|
||||
name = 'mccabe'
|
||||
version = __version__
|
||||
off_by_default = True
|
||||
|
||||
If we wanted to run the optional extension or check, we need to specify the
|
||||
error and warnings via the ``select`` setting or command line argument. In our
|
||||
case, we could run ``flake8 --select=C90`` which would run our off_by_default
|
||||
example version of the mccabe extension.
|
||||
|
||||
|
||||
Existing Extensions
|
||||
===================
|
||||
|
||||
|
|
@ -127,4 +146,4 @@ listing of the ones we are aware of:
|
|||
|
||||
.. links
|
||||
.. _mccabe: https://github.com/flintwork/mccabe
|
||||
.. _PyPI: https://pypi.python.org/pypi/
|
||||
.. _PyPI: https://pypi.python.org/pypi/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue