From a08a65b982a555c05c22068da4e2d760a62928fe Mon Sep 17 00:00:00 2001 From: Jason Myers Date: Sat, 19 Dec 2015 15:38:48 -0600 Subject: [PATCH 1/2] 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 --- docs/extensions.rst | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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/ From b0a6bada5c394ce7c43f5ff93bfc443570035f1c Mon Sep 17 00:00:00 2001 From: Jason Myers Date: Sun, 20 Dec 2015 11:23:26 -0600 Subject: [PATCH 2/2] Switching to --enable-extensions instead of --select Signed-off-by: Jason Myers --- docs/extensions.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/extensions.rst b/docs/extensions.rst index def8047..9e89fb1 100644 --- a/docs/extensions.rst +++ b/docs/extensions.rst @@ -117,9 +117,9 @@ update ``mccabe.py`` with this variable as shown below: 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. +error and warnings via the ``--enable-extension`` command line argument. In our +case, we could run ``flake8 --enable-extension=C90`` which would enable our +off_by_default example version of the mccabe extension. Existing Extensions