Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix example config #4159

Merged
merged 4 commits into from
Aug 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ install:
- pip install pylint
script:
- python pylint-recursive.py
- python json-validate.py configs/*.json.*
- python -m unittest discover -v -p "*_test.py"
2 changes: 1 addition & 1 deletion configs/config.json.cluster.example
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
},
}
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion configs/config.json.example
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
},
}
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion configs/config.json.map.example
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
},
}
}
},
{
Expand Down
4 changes: 2 additions & 2 deletions configs/config.json.optimizer.example
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"// would have transfered if the parameter was true": {},
"transfer": true,
"// 'transfer_wait_min' and 'transfer_wait_max' are the minimum and maximum": {},
"// "time to wait when transferring a pokemon": {},
"// time to wait when transferring a pokemon": {},
"transfer_wait_min": 1,
"transfer_wait_max": 4,
"// the 'evolve' parameter activate or deactivate the evolution of pokemons": {},
Expand Down Expand Up @@ -166,7 +166,7 @@
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
},
}
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion configs/config.json.path.example
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
},
}
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion configs/config.json.pokemon.example
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"berry_wait_max": 3,
"changeball_wait_min": 2,
"changeball_wait_max": 3
},
}
}
},
{
Expand Down
44 changes: 44 additions & 0 deletions json-validate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#! /usr/bin/env python
'''
Check whether a json file is loadable
'''

import json
import sys

passed = 0
failed = 0
errors = list()

def check(filename):
global passed, failed

print "CHECKING ", filename

f = open(filename).read()
try:
_ = json.loads(f)
print "PASSED: ", filename
passed += 1
return True
except ValueError as e:
failed += 1
print "FAILED: ", filename
errors.append("FILE: " + filename)
errors.append(e)
return False

return False

if __name__ == "__main__":
for filename in sys.argv[1:]:
check(filename)

print "Passed: " + str(passed) + " Failed: " + str(failed)
print "\n"
print "Showing errors:"
if failed > 0:
for err in errors:
print err

sys.exit("JSON check Failed with errors")