mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Arg spec doc comparison fixes (#36265)
* Ensure we merge doc fragments early, for comparisons * Perform boolean conversion from arg_spec data too * Update valdiate-modules ignore.txt due to recent changes
This commit is contained in:
parent
86918db312
commit
831a9d67d7
2 changed files with 211 additions and 509 deletions
File diff suppressed because it is too large
Load diff
|
@ -1019,6 +1019,15 @@ class ModuleValidator(Validator):
|
||||||
if not self.analyze_arg_spec:
|
if not self.analyze_arg_spec:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if docs is None:
|
||||||
|
docs = {}
|
||||||
|
|
||||||
|
try:
|
||||||
|
add_fragments(docs, self.object_path, fragment_loader=fragment_loader)
|
||||||
|
except Exception:
|
||||||
|
# Cannot merge fragments
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
spec, args, kwargs = get_argument_spec(self.path)
|
spec, args, kwargs = get_argument_spec(self.path)
|
||||||
except AnsibleModuleImportError as e:
|
except AnsibleModuleImportError as e:
|
||||||
|
@ -1061,12 +1070,15 @@ class ModuleValidator(Validator):
|
||||||
doc_default = docs.get('options', {}).get(arg, {}).get('default', None)
|
doc_default = docs.get('options', {}).get(arg, {}).get('default', None)
|
||||||
if data.get('type') == 'bool':
|
if data.get('type') == 'bool':
|
||||||
doc_default = maybe_convert_bool(doc_default)
|
doc_default = maybe_convert_bool(doc_default)
|
||||||
if 'default' in data and data['default'] != doc_default:
|
arg_default = data.get('default')
|
||||||
|
if 'default' in data and data.get('type') == 'bool':
|
||||||
|
arg_default = maybe_convert_bool(data['default'])
|
||||||
|
if 'default' in data and arg_default != doc_default:
|
||||||
self.reporter.error(
|
self.reporter.error(
|
||||||
path=self.object_path,
|
path=self.object_path,
|
||||||
code=324,
|
code=324,
|
||||||
msg=('Value for "default" from the argument_spec (%r) for "%s" does not match the '
|
msg=('Value for "default" from the argument_spec (%r) for "%s" does not match the '
|
||||||
'documentation (%r)' % (data['default'], arg, doc_default))
|
'documentation (%r)' % (arg_default, arg, doc_default))
|
||||||
)
|
)
|
||||||
|
|
||||||
doc_type = docs.get('options', {}).get(arg, {}).get('type', 'str')
|
doc_type = docs.get('options', {}).get(arg, {}).get('type', 'str')
|
||||||
|
@ -1087,12 +1099,6 @@ class ModuleValidator(Validator):
|
||||||
)
|
)
|
||||||
|
|
||||||
if docs:
|
if docs:
|
||||||
try:
|
|
||||||
add_fragments(docs, self.object_path, fragment_loader=fragment_loader)
|
|
||||||
except Exception:
|
|
||||||
# Cannot merge fragments
|
|
||||||
return
|
|
||||||
|
|
||||||
file_common_arguments = set()
|
file_common_arguments = set()
|
||||||
for arg, data in FILE_COMMON_ARGUMENTS.items():
|
for arg, data in FILE_COMMON_ARGUMENTS.items():
|
||||||
file_common_arguments.add(arg)
|
file_common_arguments.add(arg)
|
||||||
|
|
Loading…
Reference in a new issue