mirror of
https://github.com/esphome/esphome.git
synced 2025-06-19 14:55:40 +01:00
Updates for 1.13 (#546)
* Update CI matcher * Check Executable bit * Quicklint * Updates * Allow pm1.0 and pm10.0 for PMS5003ST Fixes https://github.com/esphome/feature-requests/issues/225 * PowerSupplyRequester * Lint * Include debug data in generated main.cpp * Updates * Auto-select bit_depth * Updates
This commit is contained in:
.travis.yml
esphome
__main__.pycodegen.pyconfig.pyconfig_validation.pyconst.py
components
binary_sensor
ble_presence
esp8266_pwm
fastled_base
integration
ledc
light
neopixelbus
output
pmsx003
power_supply
sun
time
core
core_config.pycpp_generator.pydashboard
script
tests
@ -1,10 +1,74 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env python
|
||||
|
||||
set -e
|
||||
from __future__ import print_function
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
set -x
|
||||
import argparse
|
||||
import collections
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
script/ci-custom.py
|
||||
flake8 esphome
|
||||
pylint esphome
|
||||
sys.path.append(os.path.dirname(__file__))
|
||||
from helpers import basepath, get_output, walk_files, filter_changed
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('files', nargs='*', default=[],
|
||||
help='files to be processed (regex on path)')
|
||||
parser.add_argument('-c', '--changed', action='store_true',
|
||||
help='Only run on changed files')
|
||||
args = parser.parse_args()
|
||||
|
||||
files = []
|
||||
for path in walk_files(basepath):
|
||||
filetypes = ('.py',)
|
||||
ext = os.path.splitext(path)[1]
|
||||
if ext in filetypes:
|
||||
path = os.path.relpath(path, os.getcwd())
|
||||
files.append(path)
|
||||
# Match against re
|
||||
file_name_re = re.compile('|'.join(args.files))
|
||||
files = [p for p in files if file_name_re.search(p)]
|
||||
|
||||
if args.changed:
|
||||
files = filter_changed(files)
|
||||
|
||||
files.sort()
|
||||
|
||||
errors = collections.defaultdict(list)
|
||||
cmd = ['flake8'] + files
|
||||
print("Running flake8...")
|
||||
log = get_output(*cmd)
|
||||
for line in log.splitlines():
|
||||
line = line.split(':')
|
||||
if len(line) < 4:
|
||||
continue
|
||||
file_ = line[0]
|
||||
linno = line[1]
|
||||
msg = (u':'.join(line[3:])).strip()
|
||||
errors[file_].append(u'{}:{} - {}'.format(file_, linno, msg))
|
||||
|
||||
cmd = ['pylint', '-f', 'parseable', '--persistent=n'] + files
|
||||
print("Running pylint...")
|
||||
log = get_output(*cmd)
|
||||
for line in log.splitlines():
|
||||
line = line.split(':')
|
||||
if len(line) < 3:
|
||||
continue
|
||||
file_ = line[0]
|
||||
linno = line[1]
|
||||
msg = (u':'.join(line[3:])).strip()
|
||||
errors[file_].append(u'{}:{} - {}'.format(file_, linno, msg))
|
||||
|
||||
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))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Reference in New Issue
Block a user