You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docsite/rst/dev_guide/developing_collections_documenting.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Documenting collections
7
7
Documenting modules and plugins
8
8
===============================
9
9
10
-
Documenting modules is thoroughly documented in :ref:`module_documenting`. Plugins can be documented in a similar way to modules :ref:`plugins_documenting`, that is with ``DOCUMENTATION``, ``EXAMPLES``, and ``RETURN`` blocks.
10
+
A comprehensive guide to documenting modules can be found in :ref:`module_documenting`. Plugins can be documented similarly to modules :ref:`plugins_documenting`, that is with ``DOCUMENTATION``, ``EXAMPLES``, and ``RETURN`` blocks.
Copy file name to clipboardExpand all lines: docs/docsite/rst/dev_guide/plugins_documenting.rst
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@
4
4
Plugin format and documentation
5
5
*******************************
6
6
7
-
Not all plugins can be documented, but those that can (`documentable <https://github.com/ansible/ansible/blob/devel/lib/ansible/constants.py#L111>`), follow a specific common format, except modules that have their own extended format. Also some of these plugin types (`configurable <https://github.com/ansible/ansible/blob/devel/lib/ansible/constants.py#L109>`) use the documentation to build their argument validation and type casting, unlike modules that require a separate 'args_spec'.
7
+
Not all plugins can be documented, but those that can (`documentable <https://github.com/ansible/ansible/blob/devel/lib/ansible/constants.py#L111>`), follow a specific common format, except modules that have their own extended format. Also, some of these plugin types (`configurable <https://github.com/ansible/ansible/blob/devel/lib/ansible/constants.py#L109>`) use the documentation to build their argument validation and type casting, unlike modules that require a separate 'args_spec'.
8
8
9
9
This document will describe how the plugin configuration works in general, excluding modules, which have their own `documentation reference:developing_modules_documenting`.
10
10
@@ -20,15 +20,15 @@ Every Ansible plugin must be written in Python, with modules being the main exce
20
20
21
21
.. note:: Why don't the imports go first?
22
22
23
-
Keen Python programmers may notice that contrary to PEP 8's advice we don't put ``imports`` at the top of the file. This is because the ``DOCUMENTATION`` through ``RETURN`` sections are essentially extra docstrings for the file. The imports are placed after these special variables for the same reason as PEP 8 puts the imports after the introductory comments and docstrings. This keeps the active parts of the code together and the pieces which are purely informational apart. The decision to exclude E402 is based on readability (which is what PEP 8 is about). Documentation strings in a plugin are much more similar to modulelevel docstrings. Placing the imports below this documentation and closer to the code, consolidates and groups all related code in a congruent manner to improve readability, debugging and understanding.
23
+
Keen Python programmers may notice that contrary to PEP 8's advice we don't put ``imports`` at the top of the file. This is because the ``DOCUMENTATION`` through ``RETURN`` sections are essentially extra docstrings for the file. The imports are placed after these special variables for the same reason as PEP 8 puts the imports after the introductory comments and docstrings. This keeps the active parts of the code together and the pieces which are purely informational apart. The decision to exclude E402 is based on readability (which is what PEP 8 is about). Documentation strings in a plugin are much more similar to module-level docstrings. Placing the imports below this documentation and closer to the code, consolidates and groups all related code in a congruent manner to improve readability, debugging and understanding.
24
24
25
25
26
26
.. _plugins_shebang_and_encoding:
27
27
28
28
Python shebang & UTF-8 coding
29
29
===============================
30
30
31
-
Plugins in general won't use a shebang as they are imported into Ansible's engine and not executed as a script (unlike modules).
31
+
Unlike modules, shebangs are not used by plugins since they are imported into Ansible's engine rather than being run as a script.
32
32
So your first line will normally be the encoding::
33
33
34
34
# -*- coding: utf-8 -*-
@@ -57,9 +57,9 @@ Please do not include a copyright year. If the existing copyright statement incl
57
57
DOCUMENTATION block
58
58
===================
59
59
60
-
The 3rd section is the ``DOCUMENTATION`` block. Ansible's plugin documentation is generated from the ``DOCUMENTATION`` blocks, both for the online site and the ``ansible-doc`` output. The ``DOCUMENTATION`` block must be valid YAML. You may find it easier to start writing your ``DOCUMENTATION`` string in an :ref:`editor with YAML syntax highlighting <other_tools_and_programs>` before you include it in your Python file.
60
+
The next section is the ``DOCUMENTATION`` block. Ansible's plugin documentation is generated from the ``DOCUMENTATION`` blocks, both for the online site and the ``ansible-doc`` output. The ``DOCUMENTATION`` block must be valid YAML. You may find it easier to start writing your ``DOCUMENTATION`` string in an :ref:`editor with YAML syntax highlighting <other_tools_and_programs>` before you include it in your Python file.
61
61
62
-
Plugin documentation should briefly and accurately define what each plugin is meant to accomplish and what and each option does. Documentation should be written for broad audience--readable both by experts and non-experts.
62
+
Plugin documentation should briefly and accurately define what each plugin is meant to accomplish and what and each option does. Documentation should be written for a broad audience--readable both by experts and non-experts.
63
63
* Descriptions should always start with a capital letter and end with a full stop. Consistency always helps.
64
64
65
65
To create clear, concise, consistent, and useful documentation, follow the :ref:`style guide <style_guide>`.
@@ -91,9 +91,9 @@ All fields in the ``DOCUMENTATION`` block are lower-case. All fields are require
91
91
92
92
* A detailed description (generally two or more sentences).
93
93
* Must be written in full sentences, in other words, with capital letters and periods/full stops.
94
-
* Shouldn't mention the plugin name.
94
+
* Should not mention the plugin name.
95
95
* Make use of multiple entries rather than using one long paragraph.
96
-
* Don't quote complete values unless it is required by YAML.
96
+
* Do not quote complete values unless it is required by YAML.
97
97
98
98
:version_added:
99
99
@@ -104,7 +104,7 @@ All fields in the ``DOCUMENTATION`` block are lower-case. All fields are require
104
104
105
105
* Name of the author in the form ``First Last (@GitHubID)``.
106
106
* Use a multi-line list if there is more than one author.
107
-
* Don't use quotes as it should not be required by YAML.
107
+
* Do not use quotes as it should not be required by YAML.
0 commit comments