Skip to content

Commit 4bb149a

Browse files
bcocaAkasurde
andauthored
Apply suggestions from code review
Co-authored-by: Abhijeet Kasurde <[email protected]>
1 parent d608d53 commit 4bb149a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

docs/docsite/rst/dev_guide/developing_collections_documenting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Documenting collections
77
Documenting modules and plugins
88
===============================
99

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.
1111

1212
Documenting roles
1313
=================

docs/docsite/rst/dev_guide/plugins_documenting.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Plugin format and documentation
55
*******************************
66

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'.
88

99
This document will describe how the plugin configuration works in general, excluding modules, which have their own `documentation reference:developing_modules_documenting`.
1010

@@ -20,15 +20,15 @@ Every Ansible plugin must be written in Python, with modules being the main exce
2020

2121
.. note:: Why don't the imports go first?
2222

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.
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.
2424

2525

2626
.. _plugins_shebang_and_encoding:
2727

2828
Python shebang & UTF-8 coding
2929
===============================
3030

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.
3232
So your first line will normally be the encoding::
3333

3434
# -*- coding: utf-8 -*-
@@ -57,9 +57,9 @@ Please do not include a copyright year. If the existing copyright statement incl
5757
DOCUMENTATION block
5858
===================
5959

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.
6161

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.
6363
* Descriptions should always start with a capital letter and end with a full stop. Consistency always helps.
6464

6565
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
9191

9292
* A detailed description (generally two or more sentences).
9393
* 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.
9595
* 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.
9797

9898
:version_added:
9999

@@ -104,7 +104,7 @@ All fields in the ``DOCUMENTATION`` block are lower-case. All fields are require
104104

105105
* Name of the author in the form ``First Last (@GitHubID)``.
106106
* 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.
108108

109109
:deprecated:
110110

0 commit comments

Comments
 (0)