mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Better tab checking, since we care about any tabs in the line, not just in initial indentation
This commit is contained in:
parent
72690c89bd
commit
e9de4d136f
1 changed files with 5 additions and 6 deletions
|
@ -27,7 +27,7 @@ from StringIO import StringIO
|
||||||
|
|
||||||
|
|
||||||
BLACKLIST_DIRS = frozenset(('.git',))
|
BLACKLIST_DIRS = frozenset(('.git',))
|
||||||
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] != '_'))
|
BASIC_RESERVED = frozenset((r for r in dir(module_utils_basic) if r[0] != '_'))
|
||||||
|
|
||||||
|
|
||||||
|
@ -176,11 +176,10 @@ class ModuleValidator(Validator):
|
||||||
def _check_for_tabs(self):
|
def _check_for_tabs(self):
|
||||||
for line_no, line in enumerate(self.text.splitlines()):
|
for line_no, line in enumerate(self.text.splitlines()):
|
||||||
indent = INDENT_REGEX.search(line)
|
indent = INDENT_REGEX.search(line)
|
||||||
for i in indent.groups():
|
if indent and '\t' in line:
|
||||||
if '\t' in i:
|
index = line.index('\t')
|
||||||
index = line.index('\t')
|
self.errors.append('indentation contains tabs. line %d '
|
||||||
self.errors.append('indentation contains tabs. line %d '
|
'column %d' % (line_no + 1, index))
|
||||||
'column %d' % (line_no + 1, index))
|
|
||||||
|
|
||||||
def _find_json_import(self):
|
def _find_json_import(self):
|
||||||
for child in self.ast.body:
|
for child in self.ast.body:
|
||||||
|
|
Loading…
Reference in a new issue