1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/test/sanity/validate-modules
Andrea Tartaglia 59227d8c31 Removed dict.iteritems() in several other files.
This is for py3 compatibility #18506
2016-12-14 08:01:45 -08:00
..
__init__.py Port sivel/ansible-validate-modules into Ansible 2016-10-13 14:36:22 +01:00
module_args.py Port sivel/ansible-validate-modules into Ansible 2016-10-13 14:36:22 +01:00
README.rst Add a check for type() instead of isinstance() (#18439) 2016-11-10 14:06:14 -08:00
schema.py Port sivel/ansible-validate-modules into Ansible 2016-10-13 14:36:22 +01:00
skip.txt Remove remnants of obsolete fireball mode. 2016-12-09 16:56:34 -07:00
test_validate_modules_regex.py Add a check for type() instead of isinstance() (#18439) 2016-11-10 14:06:14 -08:00
utils.py Port sivel/ansible-validate-modules into Ansible 2016-10-13 14:36:22 +01:00
validate-modules Removed dict.iteritems() in several other files. 2016-12-14 08:01:45 -08:00

validate-modules
================

Python program to help test or validate Ansible modules.

Originally developed by Matt Martz (@sivel)

Usage
~~~~~

.. code:: shell

    cd /path/to/ansible/source
    source hacking/env-setup
    test/sanity/validate-modules/validate-modules /path/to/modules

Help
~~~~

.. code:: shell

    usage: validate-modules [-h] [-w] [--exclude EXCLUDE] modules

    positional arguments:
      modules            Path to module or module directory

    optional arguments:
      -h, --help         show this help message and exit
      -w, --warnings     Show warnings
      --exclude EXCLUDE  RegEx exclusion pattern

Current Validations
===================

Modules
~~~~~~~

Errors
^^^^^^

#. Interpreter line is not ``#!/usr/bin/python``
#. ``main()`` not at the bottom of the file
#. Module does not import ``ansible.module_utils.basic``
#. Missing ``DOCUMENTATION``
#. Documentation is invalid YAML
#. Invalid schema for ``DOCUMENTATION``
#. Missing ``EXAMPLES``
#. Invalid Python Syntax
#. Tabbed indentation
#. Use of ``sys.exit()`` instead of ``exit_json`` or ``fail_json``
#. Missing GPLv3 license header in module
#. PowerShell module missing ``WANT_JSON``
#. PowerShell module missing ``POWERSHELL_COMMON``
#. New modules have the correct ``version_added``
#. New arguments have the correct ``version_added``
#. Modules should not import requests, instead use ``ansible.module_utils.urls``
#. Missing ``RETURN`` for new modules
#. Use of ``type()`` for type comparison instead of ``isinstance()``

Warnings
^^^^^^^^

#. Try/Except ``HAS_`` expression missing
#. Missing ``RETURN`` for existing modules
#. ``import json`` found
#. Module contains duplicate globals from basic.py

Module Directories (Python Packages)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Missing ``__init__.py``