mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-07 17:51:29 -07:00
Add a new check to ensure that module arguments are valid python identifiers (#53278)
* Add a new check to ensure that module arguments are valid python identifiers * Move the check up higher, out of the if docs block * Skip validate-modules on py2 * Remove errant alias
This commit is contained in:
parent
04c6f94269
commit
a639dc6d88
5 changed files with 40 additions and 4 deletions
|
@ -1301,6 +1301,14 @@ class ModuleValidator(Validator):
|
|||
"but documentation defines choices as (%r)" % (arg, arg_choices, doc_choices))
|
||||
)
|
||||
|
||||
for arg in args_from_argspec:
|
||||
if not str(arg).isidentifier():
|
||||
self.reporter.error(
|
||||
path=self.object_path,
|
||||
code=336,
|
||||
msg="Argument '%s' is not a valid python identifier" % arg
|
||||
)
|
||||
|
||||
if docs:
|
||||
file_common_arguments = set()
|
||||
for arg, data in FILE_COMMON_ARGUMENTS.items():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue