-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathlint.py
executable file
·38 lines (32 loc) · 905 Bytes
/
lint.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env python3
"""Lint the index.yaml file as well as all files ending with .mixin."""
import os
import sys
try:
from yamllint.cli import run
except ImportError:
sys.exit("Failed to import Python package 'yamllint'")
any_error = False
for name in sorted(os.listdir()):
if name != 'index.yaml' and not name.endswith('.mixin'):
continue
try:
run([
'--config-data',
'{'
'extends: default, '
'rules: {'
'document-start: {present: false}, '
'empty-lines: {max: 0}, '
'key-ordering: {}, '
'line-length: {max: 999}'
'}'
'}',
'--strict',
name,
])
except SystemExit as e:
any_error |= bool(e.code)
continue
assert False, 'run() should always raise SystemExit'
sys.exit(1 if any_error else 0)