mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Drop bottom import checking. Fixes #22
This commit is contained in:
parent
71562d83e1
commit
a90e1c353e
1 changed files with 0 additions and 21 deletions
|
@ -115,18 +115,6 @@ class ModuleValidator(Validator):
|
||||||
'__init__.py', 'VERSION', 'test-docs.sh'))
|
'__init__.py', 'VERSION', 'test-docs.sh'))
|
||||||
BLACKLIST = BLACKLIST_FILES.union(BLACKLIST_MODULES)
|
BLACKLIST = BLACKLIST_FILES.union(BLACKLIST_MODULES)
|
||||||
|
|
||||||
BOTTOM_IMPORTS = frozenset((
|
|
||||||
'ansible.module_utils.basic',
|
|
||||||
'ansible.module_utils.urls',
|
|
||||||
'ansible.module_utils.facts',
|
|
||||||
'ansible.module_utils.splitter',
|
|
||||||
'ansible.module_utils.known_hosts',
|
|
||||||
'ansible.module_utils.rax',
|
|
||||||
))
|
|
||||||
BOTTOM_IMPORTS_BLACKLIST = frozenset((
|
|
||||||
'command.py',
|
|
||||||
))
|
|
||||||
|
|
||||||
PS_DOC_BLACKLIST = frozenset((
|
PS_DOC_BLACKLIST = frozenset((
|
||||||
'slurp.ps1',
|
'slurp.ps1',
|
||||||
'setup.ps1'
|
'setup.ps1'
|
||||||
|
@ -176,9 +164,6 @@ class ModuleValidator(Validator):
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _is_bottom_import_blacklisted(self):
|
|
||||||
return self.object_name in self.BOTTOM_IMPORTS_BLACKLIST
|
|
||||||
|
|
||||||
def _is_new_module(self):
|
def _is_new_module(self):
|
||||||
return not module_loader.has_plugin(self.name)
|
return not module_loader.has_plugin(self.name)
|
||||||
|
|
||||||
|
@ -235,12 +220,6 @@ class ModuleValidator(Validator):
|
||||||
if child.module.startswith('ansible.module_utils.'):
|
if child.module.startswith('ansible.module_utils.'):
|
||||||
found_module_utils_import = True
|
found_module_utils_import = True
|
||||||
|
|
||||||
if child.module in self.BOTTOM_IMPORTS:
|
|
||||||
if (child.lineno < main - 10 and
|
|
||||||
not self._is_bottom_import_blacklisted()):
|
|
||||||
self.errors.append('%s import not near call to '
|
|
||||||
'main()' % child.module)
|
|
||||||
|
|
||||||
linenos.append(child.lineno)
|
linenos.append(child.lineno)
|
||||||
|
|
||||||
if not child.names:
|
if not child.names:
|
||||||
|
|
Loading…
Reference in a new issue