Give line no and column for indentation
This commit is contained in:
parent
cb87eeccad
commit
95c9e11cba
1 changed files with 8 additions and 6 deletions
|
@ -21,7 +21,7 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
BLACKLIST_DIRS = frozenset(('.git',))
|
BLACKLIST_DIRS = frozenset(('.git',))
|
||||||
INDENT_REGEX = re.compile(r'(^[ \t]*)', flags=re.M)
|
INDENT_REGEX = re.compile(r'(^[ \t]*)')
|
||||||
|
|
||||||
|
|
||||||
class Validator(object):
|
class Validator(object):
|
||||||
|
@ -170,11 +170,13 @@ class ModuleValidator(Validator):
|
||||||
self.errors.append('GPLv3 license header not found')
|
self.errors.append('GPLv3 license header not found')
|
||||||
|
|
||||||
def _check_for_tabs(self):
|
def _check_for_tabs(self):
|
||||||
indent = INDENT_REGEX.findall(self.text)
|
for line_no, line in enumerate(self.text.splitlines()):
|
||||||
for i in indent:
|
indent = INDENT_REGEX.search(line)
|
||||||
|
for i in indent.groups():
|
||||||
if '\t' in i:
|
if '\t' in i:
|
||||||
self.errors.append('indentation contains tabs')
|
index = line.index(i)
|
||||||
break
|
self.errors.append('indentation contains tabs. line %d '
|
||||||
|
'column %d' % (line_no, 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