diff options
author | Matt Clay <matt@mystile.com> | 2018-05-23 14:49:30 +0200 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2018-05-23 18:19:30 +0200 |
commit | 15b6837daf08f8baa94c4fea7935eb02d94fe9d5 (patch) | |
tree | 4b41a54a17eaf647323ee50c34a447b94b27ba8c /test/sanity | |
parent | add normalize_interface in module_utils and fix nxos_l3_interface module (#40... (diff) | |
download | ansible-15b6837daf08f8baa94c4fea7935eb02d94fe9d5.tar.xz ansible-15b6837daf08f8baa94c4fea7935eb02d94fe9d5.zip |
Add yamllint for plugin docs and fix issues.
Diffstat (limited to 'test/sanity')
-rw-r--r-- | test/sanity/yamllint/config/plugins.yml | 19 | ||||
-rwxr-xr-x | test/sanity/yamllint/yamllinter.py | 10 |
2 files changed, 27 insertions, 2 deletions
diff --git a/test/sanity/yamllint/config/plugins.yml b/test/sanity/yamllint/config/plugins.yml new file mode 100644 index 0000000000..6d41813787 --- /dev/null +++ b/test/sanity/yamllint/config/plugins.yml @@ -0,0 +1,19 @@ +extends: default + +rules: + braces: disable + brackets: disable + colons: disable + commas: disable + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: disable + hyphens: disable + indentation: disable + key-duplicates: disable + line-length: disable + new-line-at-end-of-file: disable + new-lines: {type: unix} + trailing-spaces: disable + truthy: disable diff --git a/test/sanity/yamllint/yamllinter.py b/test/sanity/yamllint/yamllinter.py index e9a4bb95a9..d8926e2238 100755 --- a/test/sanity/yamllint/yamllinter.py +++ b/test/sanity/yamllint/yamllinter.py @@ -40,6 +40,7 @@ class YamlChecker(object): """ yaml_conf = YamlLintConfig(file='test/sanity/yamllint/config/default.yml') module_conf = YamlLintConfig(file='test/sanity/yamllint/config/modules.yml') + plugin_conf = YamlLintConfig(file='test/sanity/yamllint/config/plugins.yml') for path in paths: extension = os.path.splitext(path)[1] @@ -50,7 +51,12 @@ class YamlChecker(object): if extension in ('.yml', '.yaml'): self.check_yaml(yaml_conf, path, contents) elif extension == '.py': - self.check_module(module_conf, path, contents) + if path.startswith('lib/ansible/plugins/'): + conf = plugin_conf + else: + conf = module_conf + + self.check_module(conf, path, contents) else: raise Exception('unsupported extension: %s' % extension) @@ -137,7 +143,7 @@ class YamlChecker(object): if not module_ast: return {} - if path.startswith('lib/ansible/modules/'): + if path.startswith('lib/ansible/modules/') or path.startswith('lib/ansible/plugins/'): for body_statement in module_ast.body: if isinstance(body_statement, ast.Assign): check_assignment(body_statement, module_doc_types) |