Commit graph

129 commits

Author SHA1 Message Date
John R Barker
04e816e13b Stricter module documentation validation (#22353)
Raise the bar for module `DOCUMENTAION`
This validator update was used to find the issues in https://github.com/ansible/ansible/pull/22297/files

**Validation**
* Updated Validation and docs to enforce more (items fixed in https://github.com/ansible/ansible/pull/22297/files)
* Use `suboptions` to document complex options 
* Validate module name
* Validate deprecated modules have correct ANSIBLE_METADATA

**Module Documentation Generation**
* Document `suboptions:` Example https://gist.github.com/gundalow/4bdc3669d696268328ccc18528cc6718
* Tidy up HTML generation (valid HTML, no empty lists, etc)
 
**Documentation**
* Clarify the steps for deprecating a module
* Use correct RST headings
* Document `suboptions:` (options)
* Document `contains:` (returns)


**Details**
The aim is to get this (and corresponding module updates) complete by the time `devel` becomes `2.4`, as this allows us to raise the bar for new modules

Example `suboptions` https://gist.github.com/gundalow/4bdc3669d696268328ccc18528cc6718

The aim is to get this PR integrated into `devel` *before* we branch `stable-2.3`, this will allows us to:
* Raise the bar for new modules in 2.4
* Ensure the generated module documentation for 2.3 and higher is improved, important as we will be doing versioned docs moving forward.
2017-03-13 19:49:27 +00:00
Matt Clay
673bfc06b9 Support option renaming in validate-modules. 2017-03-03 16:37:12 -08:00
Matt Martz
293e624235 Support matching original path for a moved module location 2017-03-03 15:13:14 -08:00
Matt Martz
958ce4a252 Create custom JSONEncoder to stringify Exceptions 2017-03-03 11:12:37 -08:00
Matt Martz
f761949cca Ensure that a deprecated module has DOCUMENTATION.deprecated (#22090) 2017-02-28 16:43:43 +00:00
Matt Clay
c448a418fd Treat deprecated modules as old during validation. 2017-02-24 13:04:51 -08:00
Matt Martz
97e12b0898 Check for imports to be between last doc line and first callable (#21863)
* Check for imports to be between last doc line and first callable

* Small readme update
2017-02-24 12:17:56 -06:00
Matt Martz
4b320ce0e4 Add checks for from module_utils import * (#21800) 2017-02-22 13:16:35 -08:00
Matt Martz
b143fdea54 DOC options must be a dict when used with extends_documentation_fragment (#21745)
* Fix string formatting
* Provide better tracebacks
* When options is None and extends_documentation_fragment is in use, add an error that options must be a dict
* If options was specified and not a dict, then error
2017-02-21 17:42:39 -08:00
Matt Martz
c160ede789 Validate modules json output (#21680) 2017-02-20 13:28:23 -08:00
Matt Martz
9b1bd2eb7e Re-enable module comparisons in validate-modules (#21582)
* Re-enable module comparisons, specifically for new module detection and for finding new options/arguments
* Only do new module checks in shippable, local will display warning
2017-02-17 15:13:18 -08:00
Matt Martz
7c00346714 Validate EXAMPLES as YAML 2017-02-15 13:01:43 -08:00
John R Barker
53ac312382 validate-modules --arg-spec (#21331)
* validate-modules --arg-spec

* Update developing_modules_documenting.rst

* Never mock out ansible or ansible.module_utils

* No more false positives
2017-02-15 08:09:08 +00:00
Matt Clay
46f9648aa1 Fix type() usage check in validate-modules.
This avoids false positives when 'if' or 'or' are in a string
preceding the use of type() on the same line.
2017-02-08 12:17:10 -08:00
Matt Clay
6580fb2cd1 Fix exception in module validator. 2017-02-02 17:38:16 -08:00
Matt Martz
829c0b8f62 Update validate-modules (#20932)
* Update validate-modules

* Validates ANSIBLE_METADATA
* Ensures imports happen after documentation vars
* Some pep8 cleanup

* Clean up some left over unneeded code

* Update modules for new module guidelines and validate-modules checks

* Update imports for ec2_vpc_route_table and ec2_vpc_nat_gateway
2017-02-02 11:45:22 -08:00
Will Thames
dce445f956 Improve error message for module validation (#19501)
Print out the data that fails to validate when doing
schema checking on modules

This allows easier interpretation of error messages.

From:

```
ERROR: DOCUMENTATION.notes.2: expected basestring
```

To:

```
ERROR: DOCUMENTATION.notes.2: expected basestring @ data['notes'][2].
Got {"As with C(include) this task can be static or dynamic, If static
it implies that it won't need templating nor loops nor conditionals and
will show included tasks in the --list options. Ansible will try to
autodetect what is needed, but you can set `static": 'yes|no` at task
level to control this.'}
```
2016-12-19 08:49:18 +00:00
Andrea Tartaglia
59227d8c31 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
2016-12-14 08:01:45 -08:00
Matt Clay
cd47cb2a15 Remove remnants of obsolete fireball mode. 2016-12-09 16:56:34 -07:00
Matt Davis
cb1888125d add metadata to doc support (#18802)
fix broken module docs
change doc AST id extraction to use == instead of in
2016-12-08 11:35:20 -05:00
Matt Clay
bd7ce0696e Fix tests after repo merge. 2016-12-08 11:35:19 -05:00
Matt Clay
6bbd92e422 Initial ansible-test implementation. (#18556) 2016-11-29 21:21:53 -08:00
jctanner
05f02371ce Add a check for type() instead of isinstance() (#18439) 2016-11-10 14:06:14 -08:00
Matt Clay
65f019fe82 Fix handling of ReaderError in validate-modules. 2016-11-09 00:37:21 -08:00
Matt Clay
1238a4c0c9 Run validate-modules with python 2 only.
This allows validate-modules to run in an environment where
python 3 is the default. This will no longer be necessary once
validate-modules is updated to work with both python 2 and 3.
2016-11-04 12:08:58 -07:00
Matt Clay
05531b99d0 Restore README.rst, update and fix formatting. (#18012)
* Revert "Update validate-modules README and convert to MD. (#18008)"
* This reverts commit 4916fe9962.
* Fix formatting of README.rst.
2016-10-13 12:47:13 -07:00
Matt Clay
4916fe9962 Update validate-modules README and convert to MD. (#18008) 2016-10-13 18:41:41 +01:00
John Barker
25286c3c7d README.rst to reference new name 2016-10-13 15:52:03 +01:00
John Barker
ef06b5501c Port sivel/ansible-validate-modules into Ansible 2016-10-13 14:36:22 +01:00