Correctly validate module name for modules with aliases (#29957)

* Correctly validate module name for modules with aliases

If a module has an alias (ie is a symlink) then we need to ensure that
DOCUMENTATION.module is set to the main name, not the aliased name

* formatting
pull/29945/head
John R Barker 7 years ago committed by GitHub
parent 1da7194534
commit bc2f4365b5

@ -802,7 +802,14 @@ class ModuleValidator(Validator):
msg='Module deprecated, but DOCUMENTATION.deprecated is missing' msg='Module deprecated, but DOCUMENTATION.deprecated is missing'
) )
if os.path.islink(self.object_path):
# This module has an alias, which we can tell as it's a symlink
# Rather than checking for `module: $filename` we need to check against the true filename
self._validate_docs_schema(doc, doc_schema(os.readlink(self.object_path).split('.')[0]), 'DOCUMENTATION', 305)
else:
# This is the normal case
self._validate_docs_schema(doc, doc_schema(self.object_name.split('.')[0]), 'DOCUMENTATION', 305) self._validate_docs_schema(doc, doc_schema(self.object_name.split('.')[0]), 'DOCUMENTATION', 305)
self._check_version_added(doc) self._check_version_added(doc)
self._check_for_new_args(doc) self._check_for_new_args(doc)

Loading…
Cancel
Save