1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix bottom import check weirdness

This commit is contained in:
Matt Martz 2015-12-22 10:55:26 -06:00 committed by John Barker
parent bc51bb97dd
commit e37ba8dd29

View file

@ -101,6 +101,7 @@ class ModuleValidator(Validator):
'ansible.module_utils.facts', 'ansible.module_utils.facts',
'ansible.module_utils.splitter', 'ansible.module_utils.splitter',
'ansible.module_utils.known_hosts', 'ansible.module_utils.known_hosts',
'ansible.module_utils.rax',
)) ))
BOTTOM_IMPORTS_BLACKLIST = frozenset(( BOTTOM_IMPORTS_BLACKLIST = frozenset((
'command.py', 'command.py',
@ -217,11 +218,8 @@ class ModuleValidator(Validator):
if child.module in self.BOTTOM_IMPORTS: if child.module in self.BOTTOM_IMPORTS:
if (child.lineno < main - 10 and if (child.lineno < main - 10 and
not self._is_bottom_import_blacklisted()): not self._is_bottom_import_blacklisted()):
self.errors.append('%s import not near main()' % self.errors.append('%s import not near call to '
child.module) 'main()' % child.module)
else:
self.warnings.append('%s import not near main()' %
child.module)
linenos.append(child.lineno) linenos.append(child.lineno)