mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Don't check for basic.py redeclarations. Fixes #10
This commit is contained in:
parent
b8b3003b29
commit
9ce546d03e
1 changed files with 1 additions and 12 deletions
|
@ -31,20 +31,18 @@ from fnmatch import fnmatch
|
||||||
|
|
||||||
from ansible import __version__ as ansible_version
|
from ansible import __version__ as ansible_version
|
||||||
from ansible.executor.module_common import REPLACER_WINDOWS
|
from ansible.executor.module_common import REPLACER_WINDOWS
|
||||||
from ansible.module_utils import basic as module_utils_basic
|
|
||||||
from ansible.plugins import module_loader
|
from ansible.plugins import module_loader
|
||||||
from ansible.utils.module_docs import BLACKLIST_MODULES, get_docstring
|
from ansible.utils.module_docs import BLACKLIST_MODULES, get_docstring
|
||||||
|
|
||||||
from schema import doc_schema, option_schema
|
from schema import doc_schema, option_schema
|
||||||
|
|
||||||
from utils import CaptureStd, find_globals
|
from utils import CaptureStd
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
|
||||||
BLACKLIST_DIRS = frozenset(('.git', 'test', '.github'))
|
BLACKLIST_DIRS = frozenset(('.git', 'test', '.github'))
|
||||||
INDENT_REGEX = re.compile(r'([\t]*)')
|
INDENT_REGEX = re.compile(r'([\t]*)')
|
||||||
BASIC_RESERVED = frozenset((r for r in dir(module_utils_basic) if r[0] != '_'))
|
|
||||||
BLACKLIST_IMPORTS = {
|
BLACKLIST_IMPORTS = {
|
||||||
'requests': ('requests import found, should use '
|
'requests': ('requests import found, should use '
|
||||||
'ansible.module_utils.urls instead'),
|
'ansible.module_utils.urls instead'),
|
||||||
|
@ -414,14 +412,6 @@ class ModuleValidator(Validator):
|
||||||
e.problem_mark.column + 1))
|
e.problem_mark.column + 1))
|
||||||
self.traces.append(e)
|
self.traces.append(e)
|
||||||
|
|
||||||
def _find_redeclarations(self):
|
|
||||||
g = set()
|
|
||||||
find_globals(g, self.ast.body)
|
|
||||||
redeclared = BASIC_RESERVED.intersection(g)
|
|
||||||
if redeclared:
|
|
||||||
self.warnings.append('Redeclared basic.py variable or '
|
|
||||||
'function: %s' % ', '.join(redeclared))
|
|
||||||
|
|
||||||
def _check_version_added(self, doc):
|
def _check_version_added(self, doc):
|
||||||
if not self._is_new_module():
|
if not self._is_new_module():
|
||||||
return
|
return
|
||||||
|
@ -536,7 +526,6 @@ class ModuleValidator(Validator):
|
||||||
self._find_module_utils(main)
|
self._find_module_utils(main)
|
||||||
self._find_has_import()
|
self._find_has_import()
|
||||||
self._check_for_tabs()
|
self._check_for_tabs()
|
||||||
self._find_redeclarations()
|
|
||||||
|
|
||||||
if self._powershell_module():
|
if self._powershell_module():
|
||||||
self._find_ps_replacers()
|
self._find_ps_replacers()
|
||||||
|
|
Loading…
Reference in a new issue