diff options
| author | Alexander Schlarb <alexander@ninetailed.ninja> | 2018-12-16 14:11:17 +0000 |
|---|---|---|
| committer | Alexander Schlarb <alexander@ninetailed.ninja> | 2018-12-16 14:11:17 +0000 |
| commit | 092427e7dd7ed6d143ec1acc0c7f4f5ccc50dc76 (patch) | |
| tree | 8c2a40d6264f2cc5bc0d299e03ef3651843b84a6 /docs/source/plugin-development | |
| parent | cad4e5be6fd0bf025d2789f08fb6c9ba832e782f (diff) | |
| download | flake8-092427e7dd7ed6d143ec1acc0c7f4f5ccc50dc76.tar.gz | |
Recommend registering plugin options using `add_options` and `parse_options` rather then `register_options` and `provide_options` since these are actually called.
Diffstat (limited to 'docs/source/plugin-development')
| -rw-r--r-- | docs/source/plugin-development/plugin-parameters.rst | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/source/plugin-development/plugin-parameters.rst b/docs/source/plugin-development/plugin-parameters.rst index d387a65..01b8b74 100644 --- a/docs/source/plugin-development/plugin-parameters.rst +++ b/docs/source/plugin-development/plugin-parameters.rst @@ -65,10 +65,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 +157,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 |
