mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 23:12:46 +03:00
run yamllint when parsing failed and also on fdroid lint runs
This commit is contained in:
parent
bb43dcf00e
commit
4e69ff582f
4 changed files with 49 additions and 16 deletions
|
@ -42,6 +42,8 @@ import urllib.request
|
|||
import zipfile
|
||||
import tempfile
|
||||
import json
|
||||
import yamllint.config
|
||||
import yamllint.linter
|
||||
|
||||
# TODO change to only import defusedxml once its installed everywhere
|
||||
try:
|
||||
|
@ -3734,3 +3736,18 @@ def force_exit(exitvalue=0):
|
|||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
os._exit(exitvalue)
|
||||
|
||||
|
||||
YAML_LINT_CONFIG = {'extends': 'default',
|
||||
'rules': {'document-start': 'disable',
|
||||
'line-length': 'disable',
|
||||
'truthy': 'disable'}}
|
||||
|
||||
|
||||
def run_yamllint(path, indent=0):
|
||||
result = []
|
||||
with open(path, 'r', encoding='utf-8') as f:
|
||||
problems = yamllint.linter.run(f, yamllint.config.YamlLintConfig(json.dumps(YAML_LINT_CONFIG)))
|
||||
for problem in problems:
|
||||
result.append(' ' * indent + path + ':' + str(problem.line) + ': ' + problem.message)
|
||||
return '\n'.join(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue