summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
Diffstat (limited to 'docs')
-rw-r--r--docs/extensions.rst21
1 files changed, 20 insertions, 1 deletions
diff --git a/docs/extensions.rst b/docs/extensions.rst
index fbab60a..def8047 100644
--- a/docs/extensions.rst
+++ b/docs/extensions.rst
@@ -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/ \ No newline at end of file
+.. _PyPI: https://pypi.python.org/pypi/