summaryrefslogtreecommitdiff
path: root/docs/source
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-05-16 20:53:04 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-05-16 20:53:04 -0500
commit6b9b4a5aca6569ca2f89a2d19fe3984718aa28e9 (patch)
tree0114a3c76b40251e0cf787a531dcd7f34f66d74d /docs/source
parent72833b629a506923f4df01cc114032c9343f8e4a (diff)
downloadflake8-6b9b4a5aca6569ca2f89a2d19fe3984718aa28e9.tar.gz
Add more information about providing information to plugins
Diffstat (limited to 'docs/source')
-rw-r--r--docs/source/dev/plugin_parameters.rst24
1 files changed, 23 insertions, 1 deletions
diff --git a/docs/source/dev/plugin_parameters.rst b/docs/source/dev/plugin_parameters.rst
index a2c8c7f..d1d6cb0 100644
--- a/docs/source/dev/plugin_parameters.rst
+++ b/docs/source/dev/plugin_parameters.rst
@@ -15,6 +15,7 @@ can accept either an AST or a range of arguments. Further, any plugin that has
certain callable attributes can also register options and receive parsed
options.
+
Indicating Desired Data
=======================
@@ -44,5 +45,26 @@ Alternatively, a plugin can accept ``tree`` and ``filename``.
``tree`` will be a parsed abstract syntax tree that will be used by plugins
like PyFlakes and McCabe.
-Finally, any plugin that has callable attributes ``provide_options`` and
+
+Registering and Parsing Options
+===============================
+
+Any plugin that has callable attributes ``provide_options`` and
``register_options`` can parse option information and register new options.
+
+Your ``register_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.
+:meth:`~flake8.options.manager.OptionManager.add_option` creates an |Option|
+which accepts the same parameters as :mod:`optparse` as well as three extra
+boolean parameters:
+
+- ``parse_from_config``
+- ``comma_separated_list``
+- ``normalize_paths``
+
+
+.. substitutions
+.. |OptionManager| replace:: :class:`~flake8.options.manager.OptionManager`
+.. |Option| replace:: :class:`~flake8.options.manager.Option`