mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-24 21:14:00 -07:00
Add yamllint for plugin docs and fix issues.
This commit is contained in:
parent
0b7932db30
commit
15b6837daf
13 changed files with 50 additions and 19 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue