rubellyte / starcheat

Starbound player save editor and Python library
http://starcheat.org/
MIT License
10 stars 5 forks source link

handle invalid JSON (empty, trailing comma) during asset import + style fixes #29

Closed chrmoritz closed 8 years ago

chrmoritz commented 8 years ago

This PR fixes the 2 instances during asset import were pythons strict JSON decoder would throw because of a invalid JSON:

After this PR we are catching this error and instead of rethrowing it (current behavior) we clean up the JSON and retry with the now valid JSON. I'm not cleaning every JSON but only the 2 invalid ones for performance reasons.

This PR fixes also some style issues, which should reduce code duplication too and make Codacy finally happy with the 1.0 support PR (at least I hope so).