Download:
child 190:010899b21c6a
parent 188:b06da1c7560e
189:4d25a227dc8b
Anton Shestakov <av6@dwimlabs.net>, Sat, 30 Jul 2016 13:05:59 +0800
checker: check linter config, complain and skip linters with problems early

1 файлов изменено, 24 вставок(+), 14 удалений(-) [+]
checker.py file | annotate | diff | comparison | revisions
--- a/checker.py Wed Jul 27 23:20:51 2016 +0800
+++ b/checker.py Sat Jul 30 13:05:59 2016 +0800
@@ -208,25 +208,38 @@
return False
print('# C&O task: setup')
-
- requested = []
+ linters = []
+ distinct = []
for linter in config.get('linters', []):
- if 'name' in linter and linter['name'] not in requested:
- requested.append(linter['name'])
- print('# C&O linters requested: {}'.format(' '.join(requested)))
+ if 'name' not in linter:
+ print("# C&O skipping linter without 'name': {}".format(linter))
+ continue
+ name = linter['name']
+ if 'include' not in linter:
+ print("# C&O skipping '{}': no 'include' in config".format(name))
+ continue
+
+ linters.append(linter)
+ if name not in distinct:
+ distinct.append(name)
+
+ print('# C&O linters requested: {}'.format(' '.join(distinct)))
linter_config = {}
- for linter in config.get('linters', []):
- if 'name' not in linter:
- continue
-
+ for linter in linters:
name = linter['name']
if name in linter_config:
continue
lc = read_linter_config(name)
- if lc is None or 'exec' not in lc:
+
+ if lc is None:
+ print("# C&O skipping '{}': no config".format(name))
+ continue
+
+ if 'exec' not in lc:
+ print("# C&O skipping '{}': no 'exec' in config".format(name))
continue
linter_config[name] = lc
@@ -243,10 +256,7 @@
print('# C&O linters installed: {}'.format(' '.join(linter_config.keys())))
print('# C&O task: checks')
- for linter in config.get('linters', []):
- if 'name' not in linter or 'include' not in linter:
- continue
-
+ for linter in linters:
if linter['name'] not in linter_config:
continue