Skip to content

Commit

Permalink
Validation errors readability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
nikuda committed Oct 7, 2016
1 parent bebe36c commit c041e7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .gitignore
@@ -1,4 +1,3 @@
/_build/
_build/
.env/
*.pyc
.env

3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -5,6 +5,9 @@ CYRAX ?= cyrax
build:
$(CYRAX)

install:
pip install -r requirements.txt

update:
git pull
$(CYRAX)
7 changes: 4 additions & 3 deletions _ext.py
Expand Up @@ -91,13 +91,14 @@ def parse_data(site):
core = Core(source_data=data, schema_files=['schema.yaml'])
core.validate(raise_exception=True)
except:
print('\n')
for error in core.errors:
path = error.path.split('/')
game = data[int(path[1])]
name = game.get('name') or game.get('names')
print('\033[91m' + error.__repr__() + '\033[0m')
print(' -- ' + str(name))
print(str(len(core.errors)) + ' errors')
print('\033[91m' + ' ' + str(name) + '\033[0m')
print(' ' + error.__repr__())
print('\n ' + str(len(core.errors)) + ' errors\n')
sys.exit(1)

for item in data:
Expand Down

0 comments on commit c041e7a

Please sign in to comment.