1
0
mirror of https://github.com/esphome/esphome.git synced 2025-06-18 06:15:46 +01:00

Update gitlab CI script, add cpp lint

This commit is contained in:
Otto Winter
2019-05-28 10:23:15 +02:00
parent f39d459555
commit a23ebead68
4 changed files with 127 additions and 107 deletions

@ -11,6 +11,19 @@ import sys
sys.path.append(os.path.dirname(__file__))
from helpers import get_output, git_ls_files, filter_changed
curfile = None
def print_error(file, lineno, msg):
global curfile
if curfile != file:
print()
print("\033[0;32m************* File \033[1;32m{}\033[0m".format(file))
curfile = file
print(u'{}:{} - {}'.format(file, lineno, msg))
def main():
parser = argparse.ArgumentParser()
@ -38,7 +51,7 @@ def main():
if not files:
sys.exit(0)
errors = collections.defaultdict(list)
errors = 0
cmd = ['flake8'] + files
print("Running flake8...")
log = get_output(*cmd)
@ -49,7 +62,8 @@ def main():
file_ = line[0]
linno = line[1]
msg = (u':'.join(line[3:])).strip()
errors[file_].append(u'{}:{} - {}'.format(file_, linno, msg))
print_error(file_, linno, msg)
errors += 1
cmd = ['pylint', '-f', 'parseable', '--persistent=n'] + files
print("Running pylint...")
@ -61,15 +75,10 @@ def main():
file_ = line[0]
linno = line[1]
msg = (u':'.join(line[3:])).strip()
errors[file_].append(u'{}:{} - {}'.format(file_, linno, msg))
print_error(file_, linno, msg)
errors += 1
for f, errs in sorted(errors.items()):
print("\033[0;32m************* File \033[1;32m{}\033[0m".format(f))
for err in errs:
print(err)
print()
sys.exit(len(errors))
sys.exit(errors)
if __name__ == '__main__':