def check_module(self, event=None): path = get_project_root(self.area.filename) child = Popen([self.path, path], stdout=PIPE, stderr=STDOUT, encoding=self.area.charset) output = child.communicate()[0] regex = '(%s):([0-9]+):(.+)' % relpath(self.area.filename) ranges = findall(regex, output) sys.stdout.write('Mypy errors: \n%s\n' % output) self.area.chmode('NORMAL') root.status.set_msg('Mypy errors: %s' % len(ranges)) if ranges: self.options(ranges)
def check(self): path = get_project_root(self.area.filename) child = Popen([self.PATH, path], stdout=PIPE, stderr=STDOUT, encoding=self.area.charset) output = child.communicate()[0] regex = '(%s):([0-9]+):?[0-9]*:(.+)' % relpath(self.area.filename) ranges = findall(regex, output) sys.stdout.write('Errors:\n%s\n' % output) self.area.chmode('NORMAL') if ranges: self.display(ranges) else: root.status.set_msg('No errors!')
def check_all(self, event=None): path = get_project_root(self.area.filename) child = Popen([self.path, path], stdout=PIPE, stderr=STDOUT, encoding=self.area.charset) output = child.communicate()[0] # Pyflakes omit the column attribute when there are # syntax errors thus the (.+?) in the beggining of the # regex is necessary. regex = '(.+?):([0-9]+):?[0-9]*:(.+)' ranges = findall(regex, output) sys.stdout.write('Pyflakes found global errors:\n%s\n' % output) self.area.chmode('NORMAL') root.status.set_msg('Pyflakes errors: %s' % len(ranges)) if ranges: self.options(ranges)
def get_root_path(self): if self.area.project: return self.area.project return get_project_root(self.area.filename)